Skip to content

Commit

Permalink
Change the default number of interpolate_shells for the formal integr…
Browse files Browse the repository at this point in the history
…al (#1512)
  • Loading branch information
chvogl authored Apr 14, 2021
1 parent 6816e21 commit ee889c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tardis/io/schemas/spectrum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ properties:
the calculation of the integrated spectrum
interpolate_shells:
type: number
default: -1
default: 0
description: Number of shells on which the formal
integral quantities are interpolated
integral quantities are interpolated. For -1 no interpolation
is used. The default is to use twice the number of computational
shells but at least 80.
virtual:
type: object
default: {}
Expand Down
9 changes: 8 additions & 1 deletion tardis/montecarlo/formal_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@ def raise_or_return(message):
return True

def calculate_spectrum(
self, frequency, points=None, interpolate_shells=-1, raises=True
self, frequency, points=None, interpolate_shells=0, raises=True
):
# Very crude implementation
# The c extension needs bin centers (or something similar)
# while TARDISSpectrum needs bin edges
self.check(raises)
N = points or self.points
if interpolate_shells == 0: # Default value
interpolate_shells = max(2 * self.model.no_of_shells, 80)
warnings.warn(
"The number of interpolate_shells was not "
f"specified. The value was set to {interpolate_shells}."
)

self.interpolate_shells = interpolate_shells
frequency = frequency.to("Hz", u.spectral())
luminosity = u.Quantity(formal_integral(self, frequency, N), "erg") * (
Expand Down

0 comments on commit ee889c8

Please sign in to comment.