Dear pyCloudy users, dear Christophe,
first of all thanks a lot for making pyCloudy possible. It is just extremely helpful.
Now, this approach provides me output files for each of the input parameter combination.
What I, however, want, is a XSPEC table model that contains all of these solutions in order to fit data with the corresponding number of free parameters.
I tried to run the loops, and then set 'save XSPEC atable spectrum "filename"' with 'set_other()' in PyCloudy, which drops the error:
> Cannot save xspec files unless doing a grid. <
Does this mean that there is no other way than adding the 'grid range' command from the hazy manual with 'set_other' in pyCloudy after I specified the input continuum like:
c_input.set_star(SED = 'table SED "table.mod"', SED_params="", lumi_unit = 'luminosity total', lumi_value=np.log10(lum_1) vary)
c_input.set_other('grid range from 38 to 42 step 1 linear')
c_input.set_other('save XSPEC atable incident continuum "atable_1_incident" ',
'save XSPEC atable spectrum "atable_1_transmitted" ')
?
This may work for a single varied parameter, but what if I want to write a atable model with more variable parameters?
In my case, my parameters are the luminosities of separate incident spectra that I define one after another.
Could I therefore define several grids and in the end call 'save XSPEC atable...' to add all solutions to one atable model?
# variable parameter 1
c_input.set_star(SED = 'table SED "table_1.mod"', SED_params="", lumi_unit = 'luminosity total', lumi_value=np.log10(lum_1) vary)
c_input.set_other('grid range from 38 to 42 step 1 linear')
# variable parameter 2
c_input.set_star(SED = 'table SED "table_2.mod"', SED_params="", lumi_unit = 'luminosity total', lumi_value=np.log10(lum_2) vary)
c_input.set_other('grid range from 38 to 42 step 1 linear')
# write XSPEC atable
c_input.set_other('save XSPEC atable incident continuum "atable_incident" ',
'save XSPEC atable spectrum "atable_transmitted" ')
Maybe, you can tell me how this can work and what would be the most elegant solution to it?
By the way, the PyCloudy function help suggests to set "total luminosity", for me only "luminosity total" worked.
Thank you very much for your help!
All the best,
Tobi