Skip to content

Commit

Permalink
Keep logspace functions together in resample
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-neal committed Aug 24, 2018
1 parent 07d6b27 commit 5c7735d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion eniric/Qcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from astropy.units.quantity import Quantity
from numpy import float64, ndarray

from eniric.utilities import log_chunks
from eniric.resample import log_chunks

c = const.c

Expand Down
13 changes: 13 additions & 0 deletions eniric/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,16 @@ def my_logspace(start, stop, base, end_point: bool = False):
n = n + 1
powers = np.arange(np.ceil(n))
return start * base ** powers


def log_chunks(wavelength, percent):
"""Define the bounds at which $(\Delta \lambda)/\lambda = X\%$.
Allows spectrum to be split into chunks in which the size is X% of the given wavelength.
This takes logarithmic steps with a base of (1+X/100).
"""
base = 1 + percent / 100.
wl_min = np.nanmin(wavelength)
wl_max = np.nanmax(wavelength)

return my_logspace(wl_min, wl_max, base, end_point=True)
13 changes: 0 additions & 13 deletions eniric/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,16 +509,3 @@ def load_btsettl_spectrum(params, photons=True, air=False):
# Turn into photon counts
flux_micron = flux_micron * wav_micron
return wav_micron, flux_micron


def log_chunks(wavelength, percent):
"""Define the bounds at which $(\Delta \lambda)/\lambda = X\%$.
Allows spectrum to be split into chunks in which the size is X% of the given wavelength.
This takes logarithmic steps with a base of (1+X/100).
"""
base = 1 + percent / 100.
wl_min = np.nanmin(wavelength)
wl_max = np.nanmax(wavelength)

return my_logspace(wl_min, wl_max, base, end_point=True)

0 comments on commit 5c7735d

Please sign in to comment.