[yt-users] yt for RAMSES

Kacper Kowalik xarthisius.kk at gmail.com
Fri Jan 15 06:43:54 PST 2016


On 01/15/2016 02:55 AM, Nicolas Gillet wrote:
> Hi Ricarda,
> 
> first I hope I answer at the right place...
> 
> - for the field issue it does not work :
> ad['all','star_age2'] and ad[('all','star_age2')] give the same error
> =>YTFieldTypeNotFound: Could not find field 'all'.
> But I can see in the derived_field_list('all', 'star_age2') and
> even('star', 'star_age2'), with 'star' my particle filter!
> 
> I have made the update to 3.3-dev
> 
> Nicolas

Hi Nicolas,
could you paste your whole script at https://paste.yt-project.org/
and back the link you'll get?
Cheers,
Kacper


> 
> 
> 
> 
> 
> Hi Nicolas,
> 
> the star ages are indeed a known and unsolved problem in yt when using
> RAMSES.
> 
> Having a quick look at your code it seems fine, you just need one more
> set of brackets when calling it: ad[('all',’star_age2’)]
> Otherwise it looks for the fields “all” and “star_age2” separately.
> 
> Does that help?
> 
> Ricarda
> 
>> /  On 14 Jan 2016, at 14:03, Nicolas Gillet <nicolas.gillet at
>> etu.unistra.fr 
>> <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>> wrote:
> />/  />/  Hello,
> />/  />/  I am Nicolas, I am a new YT user. I am working on RAMSES
> simulations.
> />/  />/  - First I have noted a "bug" (or misunderstand) in the yt.load
> of RAMSES data.
> />/  It takes all the times of the output as 'code_units' times, which
> is not the case.
> />/  The output times are negative and I think it needs a FLRW
> integration to be converted in conventional time.
> />/  Using directly the 'code_units_time' to convert in cgs time is wrong.
> />/  So all the times are false in the loaded yt data, simulation time,
> particles ages ....
> />/  />/  - My second question is link to the first point. With ramses
> there is a tool (getstarlist.f90) that extract only the stars in a .txt
> file, with the ages in Myr with the proper conversion.
> />/  My idea is to load those new data in yt, and creat a new field for
> particles, with this correct ages.
> />/  With the example I creat a filter to isolate the stars from 'all'
> particles, and it apear in the derived_field_list.
> />/  But I do not find a way to creat a new field for this filtered
> particles and even for the 'all' particles.
> />/  />/  I would like to have the possibility to have a field
> ad['star', 'my_own_ages'] or ad['all', 'my_own_ages'].
> />/  />/  What I have done:
> />/  />/  ### isolate star particles
> />/  def _star(pfilter, data):
> />/      filter = data['all', 'particle_age'] < 0
> />/      return filter
> />/  />/  add_particle_filter('star', function=_star,
> filtered_type='all', requires=['particle_age','particle_identifier'])
> />/  ds.add_particle_filter('star')
> />/  />/  ### stars are correctly created ok
> />/  />/  ### create a global star_age field, not linked to 'all' or 'star'
> />/  def _star_age(field, data):
> />/      T = data['particle_age'].in_units('Myr') * 0.
> />/      selec_stars = np.where(data['particle_age'] < 0)[0]
> />/      T[selec_stars] = Stars[5,:] * yt.units.Myr
> />/      return T
> />/  />/  ds.add_field('star_age', function=_star_age, units='Myr')
> />/  />/  />/  />/  What I try:
> />/  />/  def _star_age2(field, data):
> />/      T = data['all','particle_age'].in_units('Myr') * 0.
> />/      selec_stars = np.where(data['all','particle_age'] < 0) [0]
> />/      T[selec_stars] = Stars[5,:] * yt.units.Myr
> />/      return T
> />/  />/  ds.add_field(('all','star_age2'), function=_star_age2,
> units='Myr')
> />/  />/  ### ('all','star_age2') appear in the derived_field_list but
> />/  />/  ad['all','star_age2'] => YTFieldTypeNotFound: Could not find
> field 'all'
> />/  />/  />/  Thank you for your help,
> />/  Nicolas/
> 
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160115/1b8455be/attachment.sig>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list