Reading in arrays from Active Particles
Hi All, I'm hoping to modify YT to read in arrays from ActiveParticle fields. I have an array which is part of the AP data structure. At the moment YT sees the field but only reads the first element which kinda makes sense. Just wondering how I can modify the source code so that YT realised that a field is in fact an array and to read in all the values? At the moment YT is also complaining with the message: yt/yt/frontends/enzo/io.py:140: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 20 but corresponding boolean dimension is 1 which is because of course the field is an array of length 20 rather than a scalar. Any tips on what is required? I am looking on io.py at the _read_particle_fields function and I imagine it is this function that needs modification? Cheers, John
Hi John, The I/O operation is happening here: https://github.com/yt-project/yt/blob/master/yt/frontends/enzo/io.py#L92 Here, if you are reading an active particle field, "pds" is a handle to the hdf5 dataset containing the active particle data. The array that we're going to read the particle data into is allocated on line 110. It looks to me like "data" should be multidimensional if the on-disk data are, but perhaps we're doing something further along the line that is causing the issue you're seeing. If you get stuck, feel free to open an issue on github about this. If you do so please include a sample dataset and a script to trigger the issue so one of us can reproduce and debug. -Nathan On Thu, Sep 21, 2017 at 9:41 AM, John Regan <johnanthonyregan@gmail.com> wrote:
Hi All,
I'm hoping to modify YT to read in arrays from ActiveParticle fields. I have an array which is part of the AP data structure. At the moment YT sees the field but only reads the first element which kinda makes sense.
Just wondering how I can modify the source code so that YT realised that a field is in fact an array and to read in all the values?
At the moment YT is also complaining with the message: yt/yt/frontends/enzo/io.py:140: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 20 but corresponding boolean dimension is 1
which is because of course the field is an array of length 20 rather than a scalar.
Any tips on what is required? I am looking on io.py at the _read_particle_fields function and I imagine it is this function that needs modification?
Cheers, John
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan, Thanks for getting back to me. Yes the array is read is fine and "data" stores the array as it should. The problem appears at the masking stage. It seems the mask selects just the first element. I'm not sure what the workaround is in the case regarding the masking so I'll open an issue on github for this. I'll create small dataset that reproduces in the problem. Cheers, John On Thu, Sep 21, 2017 at 4:03 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi John,
The I/O operation is happening here:
https://github.com/yt-project/yt/blob/master/yt/frontends/enzo/io.py#L92
Here, if you are reading an active particle field, "pds" is a handle to the hdf5 dataset containing the active particle data. The array that we're going to read the particle data into is allocated on line 110. It looks to me like "data" should be multidimensional if the on-disk data are, but perhaps we're doing something further along the line that is causing the issue you're seeing.
If you get stuck, feel free to open an issue on github about this. If you do so please include a sample dataset and a script to trigger the issue so one of us can reproduce and debug.
-Nathan
On Thu, Sep 21, 2017 at 9:41 AM, John Regan <johnanthonyregan@gmail.com> wrote:
Hi All,
I'm hoping to modify YT to read in arrays from ActiveParticle fields. I have an array which is part of the AP data structure. At the moment YT sees the field but only reads the first element which kinda makes sense.
Just wondering how I can modify the source code so that YT realised that a field is in fact an array and to read in all the values?
At the moment YT is also complaining with the message: yt/yt/frontends/enzo/io.py:140: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 20 but corresponding boolean dimension is 1
which is because of course the field is an array of length 20 rather than a scalar.
Any tips on what is required? I am looking on io.py at the _read_particle_fields function and I imagine it is this function that needs modification?
Cheers, John
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
It looks like you created a new github account to create that issue, so just in case you don't have your notifications set up, I commented on the issue here: https://github.com/yt-project/yt/issues/1565#issuecomment-331484604 On Fri, Sep 22, 2017 at 3:56 AM, John Regan <johnanthonyregan@gmail.com> wrote:
Hi Nathan,
Thanks for getting back to me. Yes the array is read is fine and "data" stores the array as it should. The problem appears at the masking stage. It seems the mask selects just the first element. I'm not sure what the workaround is in the case regarding the masking so I'll open an issue on github for this. I'll create small dataset that reproduces in the problem.
Cheers, John
On Thu, Sep 21, 2017 at 4:03 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi John,
The I/O operation is happening here:
https://github.com/yt-project/yt/blob/master/yt/frontends/enzo/io.py#L92
Here, if you are reading an active particle field, "pds" is a handle to the hdf5 dataset containing the active particle data. The array that we're going to read the particle data into is allocated on line 110. It looks to me like "data" should be multidimensional if the on-disk data are, but perhaps we're doing something further along the line that is causing the issue you're seeing.
If you get stuck, feel free to open an issue on github about this. If you do so please include a sample dataset and a script to trigger the issue so one of us can reproduce and debug.
-Nathan
On Thu, Sep 21, 2017 at 9:41 AM, John Regan <johnanthonyregan@gmail.com> wrote:
Hi All,
I'm hoping to modify YT to read in arrays from ActiveParticle fields. I have an array which is part of the AP data structure. At the moment YT sees the field but only reads the first element which kinda makes sense.
Just wondering how I can modify the source code so that YT realised that a field is in fact an array and to read in all the values?
At the moment YT is also complaining with the message: yt/yt/frontends/enzo/io.py:140: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 20 but corresponding boolean dimension is 1
which is because of course the field is an array of length 20 rather than a scalar.
Any tips on what is required? I am looking on io.py at the _read_particle_fields function and I imagine it is this function that needs modification?
Cheers, John
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
John Regan
-
Nathan Goldbaum