From e384cf19fda8d51d7e69dd207e11ee34ec53b228 Mon Sep 17 00:00:00 2001 From: Macy Huston Date: Mon, 23 Feb 2026 12:32:36 +0100 Subject: [PATCH 1/2] add ST mag conversion --- spisea/synthetic.py | 51 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/spisea/synthetic.py b/spisea/synthetic.py index d8f17d87..6ddd4ecb 100755 --- a/spisea/synthetic.py +++ b/spisea/synthetic.py @@ -238,7 +238,8 @@ def _make_star_systems_table(self, mass, isMulti, sysMass): # effect is so small # Convert nan_to_num to avoid errors on greater than, less than comparisons star_systems_phase_non_nan = np.nan_to_num(star_systems['phase'], nan=-99) - bad = np.where( (star_systems_phase_non_nan > 5) & (star_systems_phase_non_nan < 101) & (star_systems_phase_non_nan != 9) & (star_systems_phase_non_nan != -99)) + bad = np.where( (star_systems_phase_non_nan > 5) & (star_systems_phase_non_nan < 101) & + (star_systems_phase_non_nan != 9) & (star_systems_phase_non_nan != -99)) # Print warning, if desired verbose=False if verbose: @@ -324,7 +325,8 @@ def _make_companions_table(self, star_systems, compMass): companions['log_a'][ii] = self.imf._multi_props.log_semimajoraxis(star_systems['mass'][companions['system_idx'][ii]]) companions['e'] = self.imf._multi_props.random_e(np.random.rand(N_comp_tot)) - companions['i'], companions['Omega'], companions['omega'] = self.imf._multi_props.random_keplarian_parameters(np.random.rand(N_comp_tot),np.random.rand(N_comp_tot),np.random.rand(N_comp_tot)) + companions['i'], companions['Omega'], companions['omega'] = self.imf._multi_props.random_keplarian_parameters( + np.random.rand(N_comp_tot),np.random.rand(N_comp_tot),np.random.rand(N_comp_tot)) # Make an array that maps system index (ii), companion index (cc) to @@ -1090,6 +1092,12 @@ def __init__(self, logAge, AKs, distance, self.make_photometry(rebin=rebin, vega=vega, comp_filters=comp_filters) + # Drop filters in the saved file that we don't actually want here + all_filters = ['m_'+get_filter_col_name(f) for f in filters] + drop_columns = [col for col in self.points.columns if (col[:2]=='m_' and + (col not in all_filters))] + self.points.remove_columns(drop_columns) + return def make_photometry(self, rebin=True, vega=vega, comp_filters=None): @@ -1892,3 +1900,42 @@ def calc_ab_vega_filter_conversion(filt_str): return vega_mag_ab +def calc_st_vega_filter_conversion(filt_str): + """ + Function to calculate the conversion between + ST and Vega magnitudes for a given filter: + m_ST - m_vega + + Note: this conversion is just the vega magnitude in + ST system + + Parameters: + ----------- + filt_str: string + Filter identification string + """ + # Get filter info + filt = get_filter_info(filt_str) + + # Interpolate the filter function to be the exact same sampling as the + # vega spectrum + c = 2.997*10**18 # A / s + filt_interp = scipy.interpolate.interp1d(filt.wave, filt.throughput, kind='linear', bounds_error=False, + fill_value=0) + s_interp = filt_interp(vega.wave) + + # Calculate the numerator + diff = np.diff(vega.wave) + numerator = np.sum(vega.flux[:-1] * s_interp[:-1] * diff) + + # Now we need to intergrate the filter response for the denominator + denominator = np.sum(s_interp[:-1] * diff) + # Fλ must be in erg cm–2 sec–1 Å–1 + + # Calculate vega AB magnitude. This is the conversion + vega_mag_st = -2.5 * np.log10(numerator / denominator) - 21.1 + + print('For {0}, m_st - m_vega = {1}'.format(filt_str, vega_mag_st)) + + return vega_mag_st + From 5f299902d4968f48fb5efccdb7895e89e59c1e5e Mon Sep 17 00:00:00 2001 From: Macy Huston Date: Mon, 23 Feb 2026 17:01:52 +0100 Subject: [PATCH 2/2] store verbose variable in IsochronePhot --- spisea/synthetic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spisea/synthetic.py b/spisea/synthetic.py index 70b9b6e1..22958efe 100755 --- a/spisea/synthetic.py +++ b/spisea/synthetic.py @@ -1118,6 +1118,7 @@ def __init__(self, logAge, AKs, distance, 'ubv,R', 'ubv,I'], verbose=False): self.metallicity = metallicity + self.verbose=verbose # Make the iso_dir, if it doesn't already exist if not os.path.exists(iso_dir):