PAHFIT / pahfit

Model Decomposition for Near- to Mid-Infrared Spectroscopy of Astronomical Sources
https://pahfit.readthedocs.io/
18 stars 26 forks source link

Standardize units #259

Closed jdtsmith closed 4 months ago

jdtsmith commented 1 year ago

What

This introduces a new file units.py which standardizes the units for science-packs, and eventually for the entire Features->Model->Fitter chain.

Why

This will:

  1. make a proper AREA-based Gaussian/Drude fitter possible (see #225)
  2. standardize the report of value in results Features tables
  3. ensure most values are within say 5 dex of unity for table glance-ability and to helping with underflow.

Note: we will convert any user input units into this format, and optionally convert tabulated/plotted output to the user's spectral units. But for specifying the PAHFIT science model to be fitted itself, these are the working units [1].

See this comment for information on how we can leverage astropy.units to understand user-input spectral units, e.g. to discriminate between flux density and spectral intensity (aka surface brightness).

Proposed PAHFIT working + output units summary:

Type Working Unit
Wavelength/FWHM/spectral_axis[2] µm
Temperature[2] K
Flux density mJy
Flux power 1e-22 W/m2
— OR —
Surface Brightness/Intensity MJy/sr
Surface Brightness Power 1e-10 W/m2/sr

[1] Internally, fitters may adopt any different units for convenience or other reasons, but that is a hidden implementation detail. For the user, these will be the working units. [2] These are already effectively standards in our science packs

codecov-commenter commented 1 year ago

Codecov Report

Merging #259 (296abe2) into master (89baf2d) will increase coverage by 0.40%. The diff coverage is 93.54%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master     #259      +/-   ##
==========================================
+ Coverage   64.78%   65.19%   +0.40%     
==========================================
  Files          14       15       +1     
  Lines        1045     1063      +18     
==========================================
+ Hits          677      693      +16     
- Misses        368      370       +2     
Impacted Files Coverage Δ
pahfit/features/features.py 74.50% <90.90%> (+0.15%) :arrow_up:
pahfit/units.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

jdtsmith commented 1 year ago

Note that this supersedes #241 ; the tied-features component of which will be submitted as a separate PR after this gets merged.

jdtsmith commented 4 months ago

An extended version of this PR is now in #284.