Skip to content

Commit

Permalink
cleanup after io test.
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-j committed Apr 28, 2024
1 parent ad63e99 commit f343e51
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/dataformat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `Observation` class

|Codename| expects the data in the form of list of ``Observations``, preferably
returned by :py:meth:`build_obs` (see below). Each Observation instance
corresponds to single dataset, and is basically a namespace that also supports
corresponds to a single dataset, and is basically a namespace that also supports
dict-like accessing of important attributes. In addition to holding data and
uncertainties thereon, they tell prospector what data to predict, contain
dataset-specific information for how to predict that data, and can even store
Expand Down Expand Up @@ -58,7 +58,8 @@ models, jitter terms, or covariant noise.

- ``name``
A string that can be used to identify the dataset. This can be useful for
dataset-specfic parameters.
dataset-specfic parameters. By default the name is constructed from the
`kind` and the memory location of the object.

- ``resolution``
For a `Spectrum` this defines the instrumental resolution. Analagously to
Expand Down
3 changes: 3 additions & 0 deletions prospect/models/sedmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ def add_dla(self, wave_rest, spec):
spec *= np.exp(-tau)
return spec

def add_damping_wing(self, wave_rest, spec):
pass

def observed_wave(self, wave, do_wavecal=False):
"""Convert the restframe wavelngth grid to the observed frame wavelength
grid, optionally including wavelength calibration adjustments. Requires
Expand Down
10 changes: 8 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ def test_observation_io(build_sps, plot=False):
obslist = build_obs(multispec=True)
model = build_model(add_neb=True)

fn = "./test.h5"
# obs writing
with h5py.File("test.h5", "w") as hf:
with h5py.File(fn, "w") as hf:
write_obs_to_h5(hf, obslist)
with h5py.File("test.h5", "r") as hf:
# obs reading
with h5py.File(fn, "r") as hf:
obsr = obs_from_h5(hf["observations"])

# cleanup?
import os
os.remove(fn)

0 comments on commit f343e51

Please sign in to comment.