Skip to content

Commit

Permalink
add a warning if when making ccf a requested wavelength range is longer
Browse files Browse the repository at this point in the history
then models
  • Loading branch information
segasai committed Jan 22, 2024
1 parent 7ee25a7 commit cf45c0b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions py/rvspecfit/make_ccf.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,14 @@ def preprocess_model(logl, lammodel, model0, vsini=None, ccfconf=None):
cont = np.maximum(cont, 1e-2 * np.median(cont))
else:
cont = 1
c_model = scipy.interpolate.interp1d(np.log(lammodel), m / cont)(logl)
if (not (lammodel[0] < logl[0] < lammodel[-1])) or (
not (lammodel[0] < logl[-1] < lammodel[-1])):
logging.warning('''The required wavelength range is bigger than the '''
'''template wavelengths''')
c_model = scipy.interpolate.interp1d(np.log(lammodel),
m / cont,
bounds_error=False,
fill_value=1)(logl)
return c_model


Expand Down Expand Up @@ -405,18 +412,21 @@ def ccf_executor(spec_setup,
D = pickle.load(fp)
vec, specs, lam, parnames = D['vec'], D['specs'], D['lam'], D[
'parnames']
log_spec = D['log_spec']
del D

nspec = specs.shape[0]
rng = np.random.Generator(np.random.PCG64(44))
inds = rng.permutation(np.arange(nspec))[:(nspec // every)]
# I randomly pickup the nspec//every spectra
specs = specs[inds, :]
if log_spec:
specs = np.exp(specs)
vec = vec.T[inds, :]
nspec = specs.shape[0]

models, params, vsinis = preprocess_model_list(lam,
np.exp(specs),
specs,
vec,
ccfconf,
vsinis=vsinis)
Expand Down

0 comments on commit cf45c0b

Please sign in to comment.