Re: Generating simulated data with Trident

24 views
Skip to first unread message

Cameron Hummels

unread,
Feb 1, 2019, 2:27:42 PM2/1/19
to Sameer, Sameer, trident-project-users
Hi Sameer,

I've moved this to our mailing list, so others can chime in if they have ideas on how to address your novel use of Trident.

Trident wasn't really designed for the task you want, that is, to generate a spectrum by specifying absorbers of arbitrary column densities, redshifts, ions, and broadenings along a line of sight.  Normally it is used to generate spectra directly from simulated datasets.  But I imagine with a little work it could function as such.  

What I *think* will work for your task is a little test function called `make_onezone_ray()` (https://trident.readthedocs.io/en/latest/generated/trident.make_onezone_ray.html#trident.make_onezone_ray).  That function allows you to generate a LightRay object of a ray passing through one-zone cloud all having the same fluid properties (density, temperature, metallicity, redshift, etc.).  You can specify your column density, ion, redshift, and temperature.  It won't let you specify a `b` value specifically, but I imagine you could figure out the temperature that produces your desired `b` value and just use that temperature.  

So if you have two absorbers at z1 and z2, you could use this function to create two `LightRay` objects, one for each absorber.  Then, you could generate a spectrum from each one of these absorbers as is done in the example in the docs.  Since you want a spectrum that includes *both* absorbers, when you generate the spectra for each of them individually, you could then co-add their `tau` (i.e. optical depth) arrays together before generating your desired flux array (i.e., the actual spectrum) using the equation `flux = e(-tau)`.  That *should* do what you want I think.

Let me know if this works, and good luck!

Cameron

On Mon, Jan 28, 2019 at 8:06 PM Sameer, Sameer <sx...@psu.edu> wrote:

Hi Dr. Hummels,


I have come across your code, Trident, which produces synthetic quasar spectra. I want to generate a normalized quasar spectrum with for example two absorbers at redshifts of z1, z2 with say absorption due to CIV, SiIV, NV, OVI with known parameters for b, log(N).


I was going through a google groups thread (https://groups.google.com/forum/#!topic/trident-project-users/M-hD2rVMvOc) that offered some insight into how to go about it, which is as follows:


>>> import yt
>>> import trident
>>> fn = <SOME DATASET>
>>> ds = yt.load(fn)
>>> ray_start = ds.domain_left_edge
>>> ray_end = ds.domain_right_edge
>>> line_list = ['H', 'C', 'N', 'O', 'Mg']
>>> ray = trident.make_simple_ray(ds, start_position=ray_start,
                              end_position=ray_end, data_filename='ray.h5',
                              lines=line_list)
>>> ad = ray.all_data()
>>> print(ad['redshift'])


For my problem, I would have to use the following command with appropriate changes for line_list

ray = trident.make_compound_ray(fn, simulation_type='Enzo',
                                near_redshift=0.0, far_redshift=0.1,
                                ftype='gas',
                                lines=line_list)

However, I don't seem to understand how I would be able to incorporate two absorbers, along with the parameters of b, log(N) and the ionization state of ion?


Thank you for the development of such a fantastic code. Hoping to hear back from you


Regards,

Sameer

Ph.D. candidate

Astronomy & Astrophysics

Penn State

http://astro.psu.edu/people/sxx15



--
Cameron Hummels
NSF Postdoctoral Fellow
Department of Astronomy
California Institute of Technology
Reply all
Reply to author
Forward
0 new messages