Skip to content

Commit

Permalink
[ci skip] fix readme links.
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-j committed Aug 28, 2024
1 parent 31167bc commit dfb3675
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ output = fit_model(observations, model, sps, **config)

Another change is that spectral response functions (i.e. calibration vectors)
are now handled by specialized sub-classes of these `Observation` classes. See
the [spectroscopy docs](docs/spectra.rst) for details.
the [spectroscopy docs](doc/spectra.rst) for details.

The interface to `write_model` has been changed and simplified. See
[usage](docs/usage.rst) for details.
[usage](doc/usage.rst) for details.

Finally, the output chain or samples is now stored as a structured array, where
each row corresponds to a sample, and each column is a parameter (possibly
Expand Down
13 changes: 8 additions & 5 deletions demo/demo_mock_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def build_obs(snr=10.0, filterset=["sdss_g0", "sdss_r0"],
:param add_noise: (optional, boolean, default: True)
If True, add a realization of the noise to the mock spectrum
"""
from prospect.data.observation import Photometry, Spectrum
from prospect.observation import Photometry, Spectrum

# We'll put the mock data in this dictionary, just as we would for real
# data. But we need to know which bands (and wavelengths if doing
Expand Down Expand Up @@ -228,13 +228,16 @@ def build_all(config):
output = fit_model(obs, model, sps, **config)

print("writing to {}".format(hfile))
writer.write_hdf5(hfile, run_params, model, obs,
output["sampling"][0], output["optimization"][0],
tsample=output["sampling"][1],
toptimize=output["optimization"][1],
writer.write_hdf5(hfile,
config,
model,
obs,
output["sampling"],
output["optimization"],
sps=sps
)


try:
hfile.close()
except(AttributeError):
Expand Down
14 changes: 9 additions & 5 deletions demo/demo_mpi_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,15 @@ def build_all(**kwargs):


hfile = "{0}_{1}_mcmc.h5".format(args.outfile, int(time.time()))
writer.write_hdf5(hfile, run_params, model, obs,
output["sampling"][0], output["optimization"][0],
tsample=output["sampling"][1],
toptimize=output["optimization"][1],
sps=sps)
writer.write_hdf5(hfile,
run_params,
model,
obs,
output["sampling"],
output["optimization"],
sps=sps
)


try:
hfile.close()
Expand Down
18 changes: 9 additions & 9 deletions demo/timing.py → tests/timing_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def make_agebins(nbin=5, minage=7.0, **extras):
allages = np.linspace(minage, np.log10(tuniv), nbin)
allages = np.insert(allages, 0, 0.)
agebins = np.array([allages[:-1], allages[1:]]).T
return agebins
return agebins



if __name__ == "__main__":

step_params = {'agebins':[[]],
'mass': [],
'tage': np.array([13.7]),
Expand All @@ -63,8 +63,8 @@ def make_agebins(nbin=5, minage=7.0, **extras):
zlist = [1, 2]
nlist = [False, True]

print("Using {} isochrones and {} spectra.\nAsking for single ages.".format(*libs))
print("Using {} isochrones and {} spectra.\nAsking for single ages.".format(*libs))

# FSPS
string = "StellarPopulation takes {:7.5f}s per call {} nebular emission and zcontinuous={}."
params = deepcopy(csp_params)
Expand All @@ -84,15 +84,15 @@ def make_agebins(nbin=5, minage=7.0, **extras):
sps = CSPBasis(zcontinuous=zcont)
dur = call_duration(sps, ntry, add_neb_emission=[neb], **params)
print(string.format(dur, w[int(neb)], zcont))

# Step SFH
nbin = 10

params = deepcopy(step_params)
params['agebins'] = make_agebins(nbin)
params['mass'] = np.ones(nbin) * 1.0
string = "FastStepBasis ({} bins) takes {:7.5f}s per call {} nebular emission and zcontinuous={}."

for zcont in zlist:
print("\n")
for neb in nlist:
Expand All @@ -101,12 +101,12 @@ def make_agebins(nbin=5, minage=7.0, **extras):
#print(sps.params, sps.ssp.params['add_neb_emission'])
print(string.format(nbin, dur, w[int(neb)], zcont))






# sys.exit()


# Now time calls for random Z (which always causes dirtiness=1)
#setup = "from __main__ import test; import numpy as np"
#call = "out=get_model(sps, logzsol=[np.random.uniform(-1, 0)], **params)"
Expand Down
File renamed without changes.

0 comments on commit dfb3675

Please sign in to comment.