-
Notifications
You must be signed in to change notification settings - Fork 28
Adds Astropy wrapper to the Thick and Thin target models #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Adds Astropy wrapper to the Thick and Thin target models #194
Conversation
Adds nonthermal to models.physical, creates an astropy wrapper that can be evaluated without units, need to add in distance and normalisation as parameters and ensure output is in correct units.
Adds Astropy class wrapper to thicktarget model which can now be evaluated along with the albedo model but fitting does not work yet.
Evaluation works using the lower energy bin edges rather than bin centers. Fitting now works if a warning from Astropy is removed that ensures x and y are of the same dinmensionlity (lines 1969-1970 in fitting.py), only the dimensionality of the output should matter.
Adds changelog anf pre-commit
Adds in the ThinTarget model class, the flux values that are returned need checking, but in principle the model class functions and can be evaluated.
Local pre-commit
Added `integrator` back into ThinTarget
Local pre-commit
"_get_integrand", | ||
"_integrate_part", | ||
"_split_and_integrate", | ||
"bremsstrahlung_thick_target", | ||
"bremsstrahlung_thin_target", | ||
"collisional_loss", | ||
"thick_fn", | ||
"thin_fn", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we necessarily want all these functions available to the user and documented.
Also could possibly just import these and only leave ether actual fitable models here e.g. ThickTarget
and ThinTarget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on where we could locate them? Perhaps we could have a _functions.py
for each set of model classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess what I was trying to say is import them from legacy for the moment and if we still rely on them when we want to remove legacy we can move them then, they are not user facing anyway
eebrk = Parameter(name="eebrk", default=100, unit=u.keV, description="Break Energy", fixed=False) | ||
|
||
q = Parameter(name="q", default=5, min=0.01, description="Slope above break", fixed=True) | ||
|
||
eelow = Parameter(name="eelow", default=7, unit=u.keV, description="Low energy electron cut off", fixed=False) | ||
|
||
eehigh = Parameter(name="eehigh", default=1500, unit=u.keV, description="High energy electron cut off", fixed=True) | ||
|
||
total_eflux = Parameter( | ||
name="total_eflux", default=1.5, unit=u.electron * u.s**-1, description="Total electron flux", fixed=True | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good opportunity to use better names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah totally agreed, I will edit these tomorrow!
Changelog edited.
Changed some of the parameter names to be more descriptive and removed uneccessary functions from `__all__`
Pre-commit
Adds an astropy model class wrapper to the thick and thin target models.
This PR changes the format of the thick and thin target models by adding an Astropy class wrapper, ThickTarget and ThinTarget, which will be located in models/physical/nonthermal.py
Currently the model can be evaluated both alone and when combined with the albedo model. Below is a plot showing the results of evaluating the model both alone and with the albedo model:
Need to address the following: