PISN & type Ia models - On hold - #415
Conversation
New pisn model classes and Jupyter workbook
pisn classes and loaders
TypeIa SN models
|
I’ll try to review this in details tomorrow; here are some initial, high-level thoughts:
|
| #convert input arguments to 1D arrays | ||
| t = u.Quantity(t, ndmin=1) | ||
| E = u.Quantity(E, ndmin=1) | ||
|
|
||
| initial_spectra = {} | ||
| for flavor in ThreeFlavor: | ||
| initial_spectra[flavor] = self.interpolation[flavor]((t, E)) / (u.MeV * u.s) |
There was a problem hiding this comment.
If both t and E are multi-element arrays (e.g. if we do model.get_flux(times, energies, d) as demonstrated in FlavorTransformation.ipynb), this will fail.
The fix could be something like:
t = u.Quantity(t, ndmin=1).to(u.s).value
E = u.Quantity(E, ndmin=1).to(u.MeV).value
tE_grid = np.stack(np.meshgrid(t, E, indexing='ij'), axis=-1)
initial_spectra = {}
for flavor in ThreeFlavor:
initial_spectra[flavor] = self.interpolation[flavor](tE_grid) / (u.MeV * u.s)(Note that we also need to remove the units in between, otherwise np.stack will complain that we’re mixing units.)
I’ve played around with a toy example to figure out the correct order of indices (self.interpolation[flavor](tE_grid)[i, j] == self.interpolation[flavor]((t[i], E[j]))), but since this is so easy to mix up, I would appreciate if someone could double-check that.
There was a problem hiding this comment.
The same applies to the TypeIa class.
Moving SNOWGLOBES model class to base.py. Will become parent to TypeIa and Wright_2017 model classes.
Moved SNOwGLoBES model class here. It will become the parent for the TypeIa and Wright_2017 model classes.
I'll fix that.
I recycled the SNOwGLoBES model class as a parent for both. This model class lives on.
I am okay with this suggestion. Do you want to keep TypeIa for backwards compatibility?
I made a single repo so there would be fewer to manage: I'd like to keep the models in separate files. |
The |
Modified SNOWGLOBES class to follow suggestion by Jost
Fix units in SNOwGLoBES class
New pisn model classes and Jupyter workbook