Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions starwave/starwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def get_cmd(self, nstars, gr_dict, pdict):
nans = (np.isnan(input_mags) + (input_mags < self.trgb)).any(axis = 1)

input_mags = input_mags[~nans]

BM_in = nans

if len(input_mags) == 0:
return input_mags, input_mags
Expand All @@ -185,8 +187,11 @@ def get_cmd(self, nstars, gr_dict, pdict):

output_mags = output_mags[~nans]

BM_out = nans

sdict = {'masses': masses, 'binqs': binqs, 'sfhs': sfhs, 'dms': dms, 'exts': exts, 'BM_in': BM_in, 'BM_out': BM_out}

return input_mags, output_mags
return input_mags, output_mags, sdict

def make_cmd(self, mags):
"""
Expand Down Expand Up @@ -381,12 +386,12 @@ def sample_cmd(self, params, model):
intensity = 10**pdict['log_int']
nstars = int(stats.poisson.rvs(intensity))

mags_in, mags_out = self.get_cmd(nstars, gr_dict, pdict)
mags_in, mags_out, sdict = self.get_cmd(nstars, gr_dict, pdict)

cmd_in = self.make_cmd(mags_in)
cmd_out = self.make_cmd(mags_out)

return cmd_in, cmd_out
return cmd_in, cmd_out, sdict

def sample_norm_cmd(self, params, model):
"""
Expand All @@ -402,7 +407,7 @@ def sample_norm_cmd(self, params, model):
list
list of two arrays, one for the noiseless CMD and one for the noisy CMD, unit-scaled
"""
in_cmd, out_cmd = self.sample_cmd(params, model)
in_cmd, out_cmd, sdict = self.sample_cmd(params, model)
if len(in_cmd) == 0 or len(out_cmd) == 0:
print('empty cmd!')
return self.dummy_cmd, self.dummy_cmd
Expand Down