[yt-users] Light Cone Projection

Britton Smith brittonsmith at gmail.com
Wed Sep 11 08:26:36 PDT 2013


Hi Pengfei,

That is right.  Using plan_cosmology_splice will allow you to minimize the
number of outputs needed to traverse a given redshift interval.  Note, that
since the start and stop positions in each dataset are random, there is no
guarantee that you will not pass through the same structure more than once,
although the odds are quite low.

I'm very glad to hear you're interested in working on this.  For starters,
you might want to read our documentation page on developing for yt, which
is here:
http://yt-project.org/doc/advanced/developing.html
This will explain some basics about how to work in a way that will make it
easiest for your contributions to be pulled into the main repository.

As for specifics on what you want to do, you should check out the yt source
file:
yt/analysis_modules/cosmological_observation/light_ray/light_ray.py

Have a look at the routine called _calculate_light_ray_solution.  This
routine is called by make_light_ray, and is responsible for creating the
list of starting and ending positions for each ray segment.  Starting on
line 165, you can see where the random initial position for a segment is
calculated.  Here is where you would want to add the ability to set a fixed
position.  A few lines down, a random trajectory is calculated, which is
used along with the length of the ray segment to determine the end point.

This should get you started.  Please, let us know if you have any more
questions.  Additionally, you might consider joining the developers mailing
list if you think you would like to continue working on yt, which would be
great!  Good luck!

Britton


On Wed, Sep 11, 2013 at 12:59 AM, Pengfei Chen <madcpf at gmail.com> wrote:

> Hi Britton,
>
> Thank you so much for your reply! I think I understand how LightRay works.
> What plan_cosmology_splice() does is to choose output redshifts so that
> comoving distance between them is approximately equal to but less than the
> comoving box size. So the light ray would not pass through the same
> structure in one dataset no matter how it travels. Is it right?
>
> Also I would like to add support to the LightRay object for setting a
> fixed initial position. Since I never modified yt or any other large code
> before, could you please give me some advice? Is there any documentation or
> tutorials I could read?
>
> Have a nice day!
>
> Pengfei
>
>
> 2013/9/9 Britton Smith <brittonsmith at gmail.com>
>
>> Hi Pengfei,
>>
>> Thank you for catching all of those errors in the source and
>> documentation.  As of now, they have all been fixed and if you do "yt
>> update" the recipe should run as normal without the need to alter anything.
>>
>> I can answer your additional questions here.
>>
>> (1) What's the initial spectrum before any absorption?
>>>
>>
>> The spectrum generator only creates absorption features.  Essentially, it
>> assumes that you have already subtracted off the continuum, so effectively
>> the input spectrum is just f(lambda) = 1.0.
>>
>>
>>> (2) Where does the light ray originate from? Is it shoot from a random
>>> position in the first dataset? Can we set it manually like on the surface
>>> of the box? Does it go out of the box and back into it until the next
>>> output redshift?
>>>
>>
>> The light ray originates in a random position inside the first dataset
>> with a random trajectory.  This code assumes a periodic domain, so the ray
>> will wrap around if it leaves the box.  Once it has traversed a distance
>> equivalent to the comoving distance to the next dataset, it terminates and
>> begins a new ray there.  Currently, you can not manually set the initial
>> position of a LightRay, but you can also using the ray object (
>> http://yt-project.org/doc/analyzing/objects.html#available-objects).  If
>> you are interested in adding support to the LightRay object for setting a
>> fixed initial position (and presumably a fixed end position), let me know
>> and I can help you get started.  If you were to do this, we would be very
>> pleased do have you contribute this code back to the main code base.
>>
>>
>>> (3) In the output file lightraysolution.txt, what do the
>>> parameters(dl/box, Start x/y/z, End x/y/z) mean?
>>>
>>
>> Since the start and stop positions are randomly chosen, this file shows
>> what those random positions are for each dataset, in case you want to know
>> that.  dl/box is the fraction of the box length that was used for a ray in
>> that dataset.  For more information on this, I would suggest you check out
>> this page:
>>
>> http://yt-project.org/doc/analysis_modules/light_ray_generator.html#light-ray-generator
>>
>> Britton
>>
>>
>>>
>>> Sorry that I have so many questions... I wonder if there is some
>>> existing documents or paper that have a more detailed description.
>>>
>>> Thank you again for your help! Have a nice weekend!
>>>
>>> Pengfei
>>>
>>>
>>>
>>> 2013/9/6 Britton Smith <brittonsmith at gmail.com>
>>>
>>>> Hi Pengfei,
>>>>
>>>> The near_redshift and far_redshift are free parameters for you to set,
>>>> and just control the redshift interval over which to make the light cone
>>>> projection.  You might also want to look at the narrative documentation on
>>>> the light cone generator, which you can find here:
>>>> http://yt-project.org/doc/analysis_modules/light_cone_generator.html
>>>> Note, that you need to use this with a simulation that made enough data
>>>> outputs to connect the redshift interval you specify.  The
>>>> "enzo_tiny_cosmology" dataset available at http://yt-project.org/data/was configured to work with the light cone recipe in the cookbook, so I
>>>> would suggest downloading that.
>>>>
>>>> As for the error, this is happening because there is a line in your
>>>> enzo parameter file that contains more than one "=" sign.  I have just
>>>> submitted a pull request that fixes it, so this should be fixed soon.  In
>>>> the mean time, you can simply comment out that line in your parameter file
>>>> and everything should work fine.
>>>>
>>>> Britton
>>>>
>>>>
>>>> On Fri, Sep 6, 2013 at 3:02 AM, Pengfei Chen <madcpf at gmail.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I downloaded the example script of light cone projectoin(
>>>>> http://yt-project.org/doc/cookbook/cosmological_analysis.html#light-cone-projection)
>>>>> to my laptop and changed the Enzo simulation parameter file and redshifts.
>>>>> But when I ran it the following error occurred:
>>>>>
>>>>>   File "light_cone_projection.py", line 19, in <module>
>>>>>     find_outputs=False)
>>>>>   File
>>>>> "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/analysis_modules/cosmological_observation/light_cone/light_cone.py",
>>>>> line 158, in __init__
>>>>>     find_outputs=find_outputs)
>>>>>   File
>>>>> "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/analysis_modules/cosmological_observation/cosmology_splice.py",
>>>>> line 44, in __init__
>>>>>     find_outputs=find_outputs)
>>>>>   File "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/convenience.py",
>>>>> line 131, in simulation
>>>>>     find_outputs=find_outputs)
>>>>>   File
>>>>> "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/frontends/enzo/simulation_handling.py",
>>>>> line 81, in __init__
>>>>>     find_outputs=find_outputs)
>>>>>   File
>>>>> "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/data_objects/time_series.py",
>>>>> line 343, in __init__
>>>>>     self._parse_parameter_file()
>>>>>   File
>>>>> "/Users/madcpf/Documents/dev_yt/src/yt-hg/yt/frontends/enzo/simulation_handling.py",
>>>>> line 273, in _parse_parameter_file
>>>>>     param, vals = (i.strip() for i in line.split("="))
>>>>> ValueError: need more than 1 value to unpack
>>>>>
>>>>> Does the parameters "near_redshift" and "far_redshift" in LightCone
>>>>> need to be the same with "CosmologyFinalRedshift" and
>>>>> "CosmologyInitialRedshift" in enzo parameter file?
>>>>> Does anyone know how to solve this?
>>>>>
>>>>> Thank you all!
>>>>>
>>>>> Pengfei
>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130911/63ba17c5/attachment.htm>


More information about the yt-users mailing list