[Feature request] Load stellar spectrum as dict
pcubillos opened this issue · 1 comments
pcubillos commented
Hi,
The exo_dict
dictionary argument of the jdi.run_pandexo(exo_dict, ...)
function allows the user to pass a user-defined stellar spectrum as a filename. It would be great if the user could pass a custom stellar spectrum as a dict (removing the need to write/read to/from file).
This can be accomplish by modifying the following lines in the outTrans() function in cretate_input.py:
if input['type'] == 'user':
if isinstance(input['starpath'], dict):
star = input['starpath']
else: #if isinstance(input['starpath'], str):
star = np.genfromtxt(input['starpath'], dtype=(float, float), names='w, f')
From the user point of view, he/she would need to set up things like this:
exo_dict = jdi.load_exo_dict()
# ...
starflux = {'f':flux_array, 'w':wavelength_array}
exo_dict['star']['type'] = 'user'
exo_dict['star']['starpath'] = starflux
# ...
How does this sound? If you agree, I can put a pull request.
Thanks.
natashabatalha commented
Sounds good. If you create a pull request to dev
soon it'll be added to master in a week or two.