Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "0.4.198"
release = "0.6.20"


# -- General configuration ---------------------------------------------------
Expand Down
56 changes: 27 additions & 29 deletions docs/usage/atmosphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,34 @@ parameters, which is usually the same as that of the sme structure,
but can be different, if for example the atmosphere is embedded, i.e.
fixed, or has not been calculated yet.

The atmopshere object has the following fields
The atmopshere object has the following fields:

- **`teff`**: Effective Temperature in Kelvin
- **`logg`**: Surface Gravity in log(cgs)
- **`monh`**: Metallicity relative to the individual abundances
- **`abund`**: The individual abundances (see [abund](#abund))
- **`vsini`**: Projected Rotational velocity in km/s
- **`vmic`**: Microturbulence velocity in km/s
- **`vmac`**: Macroturbulence velocity in km/s
- **`vturb`**: Turbulent velocity in km/s
- **`lonh`**: Mixing length
- **`source`**: Filename of the atmosphere grid
- **`depth`**:
The depth scale to use for calculations.
Either RHOX or TAU
- **`interp`**:
The depth scale to use for interpolation.
Either RHOX or TAU
- **`geom`**:
The geometry of the atmosphere. Either Plane
Parallel `'PP'` or Spherical `'SPH'`
- **`method`**:
The method to use for interpolation. Either `'grid'`
for a model grid or `'embedded'` if only a single
atmosphere is given.
- **`rhox`**: 'Column density' depth scale
- **`tau`**: 'Optical depth' depth scale
- **`temp`**: Temperature profile
- **`xna`**: Number density of atoms, ions, and molecules in each depth
- **`xne`**: Number density of electrons in each depth
|Field name|Description|Allowed values or [Unit]|
|:---:|:---:|:---:|
|`teff`|Effective Temperature|[K]|
|`logg`|Surface Gravity|[log(cgs)]|
|`monh`|Metallicity||
|`abund`|The individual abundances (see [abund](#abund))||
|`vsini`|Projected Rotational velocity|[km/s]|
|`vmic`|Microturbulence velocity|[km/s]|
|`vmac`|Macroturbulence velocity|[km/s]|
|`source`|Filename of the atmosphere grid|see [lfs](lfs.md)|
|`depth`|The depth scale to use for calculations.|`RHOX` or `TAU`|
|`interp`|The depth scale to use for interpolation.|`RHOX` or `TAU`|
|`geom`|The geometry of the atmosphere.|Plane Parallel `'PP'` or Spherical `'SPH'`|
|`method`|The method to use for interpolation|`'grid'` for a model grid or `'embedded'` if only a single atmosphere is given|
|`rhox`|Mass column at each tabulated depth in the atmosphere|[$\mathrm{g~cm^{-2}}$]|
|`tau`|Continuum optical depth at each tabulated depth in the atmosphere||
|`temp`|Temperature at each tabulated depth in the atmosphere|[K]|
|`xna`|Atomic number density (including atomic components of molecules) at each tabulated depth in the atmosphere.|[$\mathrm{cm^{-3}}$]|
|`xne`|Electron number density at each tabulated depth in the atmosphere|[$\mathrm{cm^{-3}}$]|
|`rho`|Mass density at each tabulated depth in the atmosphere.|[$\mathrm{g~cm^{-3}}$]|
|`height`|Height above or below `radius` at each tabulated depth in a spherical atmosphere.|[cm]|
|`radius`|Stellar radius corresponding to `height` of zero in a spherical atmosphere|[cm]|
|`vturb`|Turbulent velocity used to generate the atmosphere|[km/s]|
|`lonh`|Ratio of mixing length to pressure scale height (`/H) used to generate the atmosphere.||
|`wlstd`|Wavelength for continuum optical depth scale.|Å, Default value: 5000Å|
|`opflag`|Flags that indicate whether to enable various opacity packages during the radiative transfer calculation||

## Grid atmospheres

Expand Down
9 changes: 9 additions & 0 deletions docs/usage/fordev.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ This variable determines how the cscale and vrad being assigned, and can be spec
If you create your own NLTE departure coefficient grid following the current public grid to a `DirectAccess` file and you use the `nlte.DirectAccess.wrtie` function, note that the `wrtie` and `read` code changes the shape of b-grid, tau and rhox.
Some extra test is needed to clear the situation.

## SME

### `Trasf` function

1. `AutoIonization`
2. Calculate Line center opacity using `LINEOPAC`.
3. Calculate Line contribution limits using `OPMTRX`.
- Step 2 and 3 go through all the input lines

## IDLSME

### Installation
Expand Down
5 changes: 5 additions & 0 deletions docs/usage/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Currently PySME is tested with Python verion 3.9-3.13.
- For the "stable" version (recommended):
- `pip install pysme-astro`

```{warning}
- PySME requires the pre-compled C++/Fortran SME library to run. Currently we deliver SME library with Linux and Mac version; for Windows users, we recommend to use WSL and hence the Linux version.
- The files (mainly atmosphere models and NLTE departure coefficnent grids) required by PySME will be saved inside `~/.sme/`. These files can be large thus if your home directory is small, we recommend to create a softlink for `~/.sme`.
```

```{warning}
PySME requires the pre-compled C++/Fortran SME library to run. Currently we deliver SME library with Linux and Mac version; for Windows users, we recommend to use WSL and hence the Linux version.
```
Expand Down
2 changes: 1 addition & 1 deletion src/pysme/atmosphere/marcsfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def __init__(self, filename, calcRHOX=False):
if self.geom.upper() == 'SPH':
self.radius = data["radius"]
self.depth = 'RHOX' if self.geom.upper() == 'SPH' else 'TAU' # spherical models should depth calculate using RHOX
self.interp = 'TAU' # not sure this is needed for embedded models
self.interp = 'RHOX' # not sure this is needed for embedded models
self.vturb = data["vturb"]

self.abund = Abund(monh=data["monh"], pattern=data["abund_inclmonh"].to_numpy()[0]-data["monh"], type="H=12")
Expand Down
2 changes: 1 addition & 1 deletion src/pysme/gui/plot_plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def create_plot(self, current_segment):
if self.lines is not None and len(self.lines) != 0:
seg_annotations = []
xlimits = self.wave[seg][[0, -1]]
xlimits *= 1 - self.vrad[seg] / clight
xlimits = xlimits * (1 - self.vrad[seg] / clight)
lines = (self.lines.wlcent > xlimits[0]) & (
self.lines.wlcent < xlimits[1]
)
Expand Down
11 changes: 5 additions & 6 deletions src/pysme/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ def sanitize_parameter_names(self, sme, param_names):
if sme.vrad_flag in ["fix", "none"]:
sme.vrad_flag = "whole"
logger.info(
"Removed fit parameter 'vrad', instead set radial velocity flag to %s",
sme.vrad_flag,
f"Removed fit parameter 'vrad', instead set radial velocity flag to {sme.vrad_flag}"
)

if "cont" in param_names:
Expand Down Expand Up @@ -734,9 +733,9 @@ def solve(self, sme, param_names=None, segments="all", bounds=None, step_sizes=N
)

# Setup LineList only once (Mingjie: not needed?)
dll = self.synthesizer.get_dll()
dll.SetLibraryPath()
_ = dll.InputLineList(sme.linelist)
# dll = self.synthesizer.get_dll()
# dll.SetLibraryPath()
# _ = dll.InputLineList(sme.linelist)

# Do the heavy lifting
if self.nparam > 0:
Expand Down Expand Up @@ -794,7 +793,7 @@ def solve(self, sme, param_names=None, segments="all", bounds=None, step_sizes=N
# We could try to reuse the already calculated synthetic spectrum (if it already exists)
# However it is much lower resolution then the newly synthethized one (usually)
# Therefore the radial velocity wont be as good as when redoing the whole thing
sme = self.synthesizer.synthesize_spectrum(sme, segments)
sme = self.synthesizer.synthesize_spectrum(sme, segments, linelist_mode=linelist_mode)
else:
raise ValueError("No fit parameters given")

Expand Down
Loading
Loading