mors.spectrum
spectrum
Module for deriving stellar spectra from band-integrated fluxes
bands_ascending = ['xr', 'e1', 'e2', 'uv', 'pl']
module-attribute
bands_limits = {'xr': [0.517, 12.5], 'e1': [10.0, 32.0], 'e2': [32.0, 92.0], 'uv': [92.0, 400.0], 'pl': [400.0, 1000000000.0], 'bo': [0.001, 1000000000.0]}
module-attribute
log = logging.getLogger('fwl.' + __name__)
module-attribute
Spectrum()
Source code in src/mors/spectrum.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
CalcBandFluxes()
Calculate integrated fluxes for each band.
Integrated fluxes will have units of [erg s-1 cm-2] scaled to 1 AU.
Source code in src/mors/spectrum.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
ExtendPlanck(Teff, R_star, wl_max)
Extend spectrum to longer wavelengths using planck function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Teff
|
float
|
Effective temperature of star |
required |
R_star
|
float
|
Radius of star [m] |
required |
wl_max
|
float
|
New maximum wavelength [nm] |
required |
Source code in src/mors/spectrum.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
ExtendShortwave(wl_min)
Extend spectrum to shorter wavelengths using constant value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wl_min
|
float
|
New minimum wavelength [nm] |
required |
Source code in src/mors/spectrum.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
LoadDirectly(spec_wl, spec_fl)
Store spectral data in object.
Scaled to 1 AU.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_wl
|
ndarray
|
Array of wavelengths [nm] |
required |
spec_fl
|
ndarray
|
Array of fluxes [erg s-1 cm-2 nm-1] |
required |
Source code in src/mors/spectrum.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
LoadTSV(fp)
Load stellar spectrum from TSV file into memory.
Scaled to 1 AU. File should be whitespace delimited with units of [nm] and [erg s-1 cm-2 nm-1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fp
|
str
|
Path to file |
required |
Source code in src/mors/spectrum.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
WriteTSV(fp)
Write spectrum to file(s) on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fp
|
str
|
Path to file |
required |
Source code in src/mors/spectrum.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
PlanckFunction_surf(wl, Teff)
Returns the planck fluxes evaluated at the wavelength array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wl
|
ndarray
|
Wavelength array [nm] |
required |
Teff
|
float
|
Effective temperature of the object |
required |
Returns:
| Name | Type | Description |
|---|---|---|
yp |
float
|
Flux at stellar surface [erg s-1 cm-2 nm-1] |
Source code in src/mors/spectrum.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
ScaleTo1AU(fl, R_star)
Scale spectrum from stellar surface to 1AU
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fl
|
ndarray
|
Spectrum at surface |
required |
R_star
|
float
|
Star radius in [m] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
fl_1AU |
ndarray
|
Flux at 1 AU (same units as |
Source code in src/mors/spectrum.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
ScaleToSurf(fl, R_star)
Scale spectrum from 1 AU to stellar surface
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fl
|
ndarray
|
Spectrum at 1 AU |
required |
R_star
|
float
|
Star radius in [m] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
fl_surf |
ndarray
|
Flux at stellar surface (same units as |
Source code in src/mors/spectrum.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
WhichBand(wl)
Determine which band(s) this wavelength is inside of
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wl
|
float
|
Wavelength to query [nm] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bands |
list | None
|
List of band names (strings) which this band is inside of. Bands
can overlap, so this list may have a length greater than one.
If |
Source code in src/mors/spectrum.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |