pahfit
pahfit copied to clipboard
Modular science pack idea
In my recent work, I have started a new habit where I treat science packs in a modular way.
An example use cases is as follows:
You have two objects:
- A PDR
- A galaxy
And you would like a science pack situation as follows
- dust_feature tuning: keep it the same for both. And you are making frequent adjustment as testing them on both objects.
- dust_continuum tuning: custom for each. And the galaxy needs a starlight component too.
- (lines: separate pack for PDR and galaxy)
In that case you could put the dust features in a general file, and the continuum in separate ones
dust_features.yaml, continuum_pdr.yaml, continuum_galaxy.yaml
To load them and combine them into a single science pack, I wrote the following function
from astropy.table import vstack
def make_multi_yaml_model(*args):
return Model(vstack([Features.read(fn) for fn in args]))
If we think this would be something useful for the general userbase, the minimum effort to implement this would be to just allow Model
to take a list of YAML files at setup, and make it apply this function. In practice, it would probably be best to include a few checks though. Most importantly, making sure that all feature names are unique.