<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I am Nicolas, I am a new YT user. I am working on RAMSES
    simulations.<br>
    <br>
    - First I have noted a "bug" (or misunderstand) in the yt.load of
    RAMSES data.<br>
    It takes all the times of the output as 'code_units' times, which is
    not the case.<br>
    The output times are negative and I think it needs a FLRW
    integration to be converted in conventional time.<br>
    Using directly the 'code_units_time' to convert in cgs time is
    wrong.<br>
    So all the times are false in the loaded yt data, simulation time,
    particles ages ....<br>
    <br>
    - 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.<br>
    My idea is to load those new data in yt, and creat a new field for
    particles, with this correct ages.<br>
    With the example I creat a filter to isolate the stars from 'all'
    particles, and it apear in the derived_field_list.<br>
    But I do not find a way to creat a new field for this filtered
    particles and even for the 'all' particles.<br>
    <br>
    I would like to have the possibility to have a field ad['star',
    'my_own_ages'] or ad['all', 'my_own_ages'].<br>
    <br>
    What I have done:<br>
    <br>
    <font color="#3333ff">### isolate star particles<br>
      def _star(pfilter, data):<br>
          filter = data['all', 'particle_age'] < 0<br>
          return filter<br>
      <br>
      add_particle_filter('star', function=_star, filtered_type='all',
      requires=['particle_age','particle_identifier'])<br>
      ds.add_particle_filter('star')<br>
      <br>
      ### stars are correctly created ok<br>
      <br>
      ### create a global star_age field, not linked to 'all' or 'star'<br>
      def _star_age(field, data):<br>
          T = data['particle_age'].in_units('Myr') * 0.<br>
          selec_stars = np.where(data['particle_age'] < 0)[0]<br>
          T[selec_stars] = Stars[5,:] * yt.units.Myr<br>
          return T<br>
      <br>
      ds.add_field('star_age', function=_star_age, units='Myr')</font><br>
    <br>
    <br>
    <br>
    What I try:<br>
    <font color="#cc0000"><br>
      def _star_age2(field, data):<br>
          T = data['all','particle_age'].in_units('Myr') * 0.<br>
          selec_stars = np.where(data['all','particle_age'] < 0) [0]<br>
          T[selec_stars] = Stars[5,:] * yt.units.Myr<br>
          return T<br>
      <br>
      ds.add_field(('all','star_age2'), function=_star_age2,
      units='Myr')<br>
      <br>
      ### ('all','star_age2') appear in the derived_field_list</font>
    but<br>
    <br>
    <font color="#cc0000">ad['all','star_age2'] => </font><span class="ansicyan" style="box-sizing: border-box; color: rgb(70,
      130, 180);"><span class="ansigreen" style="box-sizing: border-box;
        color: rgb(0, 100, 0);"><span class="ansicyan" style="box-sizing: border-box; color: rgb(70, 130, 180);"><span class="ansigreen" style="box-sizing: border-box; color:
            rgb(0, 100, 0);"><span class="ansicyan" style="box-sizing:
              border-box; color: rgb(70, 130, 180);"><span class="ansigreen" style="box-sizing: border-box; color:
                rgb(0, 100, 0);"><span class="ansiyellow" style="box-sizing: border-box; color: rgb(196, 160,
                  0);"><span class="ansired" style="box-sizing:
                    border-box; color: rgb(139, 0, 0);">YTFieldTypeNotFound</span>:
                  Could not find field 'all'</span></span></span></span></span></span></span>
    
    <br>
    <br>
    <br>
    Thank you for your help,<br>
    Nicolas<br>
    <br>
    <br>
    <br>
  </body>
</html>