-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out luminosity calculation, add setup solver method
- Loading branch information
1 parent
e1aa887
commit 4401047
Showing
3 changed files
with
102 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import astropy.units as u | ||
import numpy as np | ||
|
||
|
||
def calculate_emitted_luminosity( | ||
emitted_packet_nu, | ||
emitted_packet_luminosity, | ||
luminosity_nu_start=0 * u.Hz, | ||
luminosity_nu_end=np.inf * u.Hz, | ||
): | ||
""" | ||
Calculate emitted luminosity. | ||
Parameters | ||
---------- | ||
emitted_packet_nu : | ||
emitted_packet_luminosity : | ||
luminosity_nu_start : astropy.units.Quantity | ||
luminosity_nu_end : astropy.units.Quantity | ||
Returns | ||
------- | ||
astropy.units.Quantity | ||
""" | ||
luminosity_wavelength_filter = (emitted_packet_nu > luminosity_nu_start) & ( | ||
emitted_packet_nu < luminosity_nu_end | ||
) | ||
|
||
return emitted_packet_luminosity[luminosity_wavelength_filter].sum() | ||
|
||
|
||
def calculate_reabsorbed_luminosity( | ||
reabsorbed_packet_nu, | ||
reabsorbed_packet_luminosity, | ||
luminosity_nu_start=0 * u.Hz, | ||
luminosity_nu_end=np.inf * u.Hz, | ||
): | ||
""" | ||
Calculate reabsorbed luminosity. | ||
Parameters | ||
---------- | ||
reabsorbed_packet_nu : | ||
reabsorbed_packet_luminosity : | ||
luminosity_nu_start : astropy.units.Quantity | ||
luminosity_nu_end : astropy.units.Quantity | ||
Returns | ||
------- | ||
astropy.units.Quantity | ||
""" | ||
luminosity_wavelength_filter = ( | ||
reabsorbed_packet_nu > luminosity_nu_start | ||
) & (reabsorbed_packet_nu < luminosity_nu_end) | ||
|
||
return reabsorbed_packet_luminosity[luminosity_wavelength_filter].sum() |