-
-
Notifications
You must be signed in to change notification settings - Fork 423
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
Refactor spectrum #729
Refactor spectrum #729
Conversation
The refactor changes the way a spectrum is handled. Instead of creating a spectrum and updating it after each montecarlo iteration, we create a new spectrum from the MontecarloRunner whenever it is needed. Benefits: - TARDISSpectrum is now a general purpose spectrum class that is not linked to the Iteration sheme anymore. - It is now possible to save spectra for all iterations without them being updated each iteration. - This class can now also be used for spectra created by the formal integral approach (upcoming PR tardis-sn#726)
@yeganer add function to calculate flux using distance. |
@yeganer add deprecation warning to flux |
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.
remove and add stuff as discussed.
tardis/montecarlo/base.py
Outdated
@@ -37,14 +37,11 @@ def __init__(self, seed, spectrum_frequency, virtual_spectrum_range, | |||
self.packet_source = packet_source.BlackBodySimpleSource(seed) | |||
self.spectrum_frequency = spectrum_frequency | |||
self.virtual_spectrum_range = virtual_spectrum_range | |||
self.distance = distance |
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.
remove
tardis/montecarlo/base.py
Outdated
self.spectrum_reabsorbed.update_luminosity( | ||
montecarlo_reabsorbed_luminosity) | ||
@property | ||
def spectrum_virtual(self): |
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.
add warning
tardis/montecarlo/base.py
Outdated
return TARDISSpectrum( | ||
self.spectrum_frequency, | ||
self.montecarlo_virtual_luminosity, | ||
self.distance) |
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.
remove
tardis/montecarlo/spectrum.py
Outdated
HDF_PROPERTIES = [ | ||
'_frequency', | ||
'luminosity', | ||
'distance' |
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.
remove
This concludes the refactoring of TARDISSpectrum. The syntax for the dummy to_hdf was slightly changed to match the syntax of pandas to_hdf() methods. That means the 'name' parameter was removed as there is no reason for the function do decide where it should save to and the path is now a required argument.
4297d48
to
ae46cc3
Compare
@wkerzendorf Do we still want a |
@yeganer the flux should get a deprecation warning. |
spec_from) | ||
|
||
|
||
def test_creat_from_wl(spectrum): |
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.
You could maybe move this test into a separate section, since it does not belong into the "Load and Save" category.
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.
Good point, I added another section.
aaa85b6
to
c3b1a69
Compare
c3b1a69
to
4f0e7b5
Compare
@tardis-sn/tardis-core I'm done with this PR, if there are no further comments, this can be merged. |
The refactor changes the way a spectrum is handled. Instead of creating
a spectrum and updating it after each montecarlo iteration, we create a
new spectrum from the MontecarloRunner whenever it is needed.
Benefits:
linked to the Iteration sheme anymore.
being updated each iteration.
integral approach (upcoming PR [WIP] Basic implementation of the formal integral #726)