Skip to content

write_hdf5 function returning TypeError for dataset creation #376

@mverrico

Description

@mverrico

Hello! I am trying to run Prospector 2.0 and am having some trouble with writing to a result file. I fit a Spectrum and Photometry object using Dynesty for nested sampling. When I try to use the built-in writer.write_hdf5 function, I get a TypeError inside the function. The full traceback is below.

File "/projects/ncsa/caps/verrico2/psb_quasars/Code/param_file.py", line 576, in <module> writer.write_hdf5(hfile, File "/projects/ncsa/caps/verrico2/.conda/envs/psb_quasar_prospector/lib/python3.10/site-packages/prospect/io/write_results.py", line 150, in write_hdf5 _ = opt.create_dataset('optimizer_results', data=optarr) File "/projects/ncsa/caps/verrico2/.conda/envs/psb_quasar_prospector/lib/python3.10/site-packages/h5py/_hl/group.py", line 186, in create_dataset dsid = dataset.make_new_dset(group, shape, dtype, data, name, **kwds) File "/projects/ncsa/caps/verrico2/.conda/envs/psb_quasar_prospector/lib/python3.10/site-packages/h5py/_hl/dataset.py", line 88, in make_new_dset tid = h5t.py_create(dtype, logical=1) File "h5py/h5t.pyx", line 1680, in h5py.h5t.py_create File "h5py/h5t.pyx", line 1704, in h5py.h5t.py_create File "h5py/h5t.pyx", line 1731, in h5py.h5t.py_create File "h5py/h5t.pyx", line 1637, in h5py.h5t._c_compound File "h5py/h5t.pyx", line 1704, in h5py.h5t.py_create File "h5py/h5t.pyx", line 1777, in h5py.h5t.py_create TypeError: No conversion path for dtype: dtype('<U50')

I am writing the results of the fit to the output file as outlined in the tutorial:

`output = fit_model(obs, model, sps, lnprobfn=lnprobfn, **run_params)

print("Fit_model complete")https://sites.google.com/view/astrobites/home?authuser=0
print(model)

print("writing to {}".format(hfile))
writer.write_hdf5(hfile,
                  run_params, ## in docs, this is 'config,' so if copy-pasting, need to edit
                  model,
                  obs,
                  output["sampling"],
                  output["optimization"],
                  sps=sps
                  )

`

I am using Python 3.10.18, Prospector 2.0a2.dev42+gff8d5e4, h5py 3.14.0, and hdf5 1.14.6. Please let me know if there is something I am doing wrong. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions