Skip to content

Commit

Permalink
Fixed appending issue with Vega spectrum
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed Mar 30, 2024
1 parent 7a6c03d commit 8d71659
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions species/phot/syn_phot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,18 @@ def calc_zero_point(self) -> Union[float, np.float64]:
read_filt = ReadFilter(self.filter_name)
self.wavel_range = read_filt.wavelength_range()

with h5py.File(self.database, "a") as h5_file:
if "spectra/calibration/vega" not in h5_file:
add_vega(self.data_folder, h5_file)
with h5py.File(self.database, "r") as hdf5_file:
if "spectra/calibration/vega" in hdf5_file:
vega_found = True
else:
vega_found = False

if not vega_found:
with h5py.File(self.database, "a") as hdf5_file:
add_vega(self.data_folder, hdf5_file)

vega_spec = np.array(h5_file["spectra/calibration/vega"])
with h5py.File(self.database, "r") as hdf5_file:
vega_spec = np.array(hdf5_file["spectra/calibration/vega"])

wavelength = vega_spec[0,]
flux = vega_spec[1,]
Expand Down

0 comments on commit 8d71659

Please sign in to comment.