Tutorial: First run
What you’ll do
By the end of this tutorial you will:
- Install MORS and download the required data
- Create a
Starand compute evolutionary tracks - Inspect available tracks + units
- Plot one track
- Find stellar values at specific ages
- Save and reload the result
Time/units cheat sheet:
Mstarin M☉,Agein Myr,Protin days,Omegain Ω☉.
0) Prerequisites
You need:
- Python 3 environment with
pip - A working internet connection (for downloading data once)
Optional: Create and activate a Conda environment (requires conda installed):
conda create -n mors python=3.11 -y
conda activate mors
No conda? create and activate a virtual environment (venv):
python -m venv .venv
source .venv/bin/activate
1) Install MORS
pip install fwl-mors
Quick sanity check:
python -c "import mors; print('mors imported:', mors.__version__ if hasattr(mors,'__version__') else 'ok')"
2) Download stellar evolution data
MORS requires stellar evolution tracks (downloaded once):
mors download all
See where data are stored:
mors env
If you want to place data somewhere else, set FWL_DATA (optional):
export FWL_DATA=/path/to/your/data
3) Create your first star
Create a 1 M☉ star with an initial rotation period of 2.7 days (at ~1 Myr):
import mors
star = mors.Star(Mstar=1.0, Prot=2.7)
Alternative: specify initial rotation as Ω/Ω☉:
star = mors.Star(Mstar=1.0, Omega=10.0)
4) Inspect what tracks exist
Print track names and units:
star.PrintAvailableTracks()
print("Lx units:", star.Units.get("Lx"))
You can access arrays either via the Tracks dict:
age = star.Tracks["Age"]
lx = star.Tracks["Lx"]
age = star.AgeTrack
lx = star.LxTrack
5) Plot a track
import matplotlib.pyplot as plt
plt.plot(star.AgeTrack, star.LxTrack)
plt.xlabel(f"Age [{star.Units['Age']}]")
plt.ylabel(f"Lx [{star.Units['Lx']}]")
plt.show()
If you see a plot and no errors, your installation + data are working.
6) Find stellar values at specific ages
Use the generic accessor:
print(star.Value(Age=150.0, Quantity="Lx"))
Or a convenience method (when available):
print(star.Lx(150.0))
7) (Optional) Try percentiles: slow/medium/fast rotators
This uses the built-in model distribution:
slow = mors.Star(Mstar=1.0, percentile="slow") # 5th percentile
medium = mors.Star(Mstar=1.0, percentile="medium") # 50th percentile
fast = mors.Star(Mstar=1.0, percentile="fast") # 95th percentile
print("slow percentile:", slow.percentile)
print("fast percentile:", fast.percentile)
8) Save and reload (recommended)
Save:
star.Save(filename="star.pickle")
Reload later:
import mors
star2 = mors.Load("star.pickle")
print(star2.Lx(150.0))