Giter Site home page Giter Site logo

Comments (9)

RemiLehe avatar RemiLehe commented on June 1, 2024

Thanks for pointing out a potential issue.
However, what do you mean by "assumes dump period == 1" in the title ? In the openPMD-example-datasets for instance, the dump period is 100 PIC cycles, and the openPMD-viewer can read it without problems.

I am unsure if this is what you mean, but note that current_i is never directly used as the iteration, in the code. Instead, we use self.iterations[self.current_i], since, as you mentioned, current_i represents the n-th output and not the iteration of that output.

Do you have maybe a concrete example to illustrate how the current code would fail?

from openpmd-viewer.

ax3l avatar ax3l commented on June 1, 2024

Ah the title is misleading, yes! I had a restarted simulation in PIConGPU that was running between steps [5'000:9'000] and only contained those outputs. At some point in the post-processing, I wanted to know "what real time is it" for a certain iteration.

The variable current_i, a publicly accessible member, is a bit ill-named (current_i: iteration, current_t: time) for the above mentioned usage. I also had no way to implement a ts.find_time(iteration) function into OpenPMDTimeSeries without reading a specific record and using its meta attributes.

from openpmd-viewer.

RemiLehe avatar RemiLehe commented on June 1, 2024

OK, thanks for the clarification.

Here are a few suggestions of what coud be changed:

  • Regarding the fact that current_i is a public attribute: note that, in Python, all class attribute are public. However, we can rename it as _current_i (in Python-world, the underscore means that the attribute is intended to be private - although it is technically still public)

  • Regarding the finding the time that corresponds to a given iteration, it can be done by:

t = ts.t[ ts.iterations == iteration ]

But we could also define a function find_time that does this. What do you think?

from openpmd-viewer.

ax3l avatar ax3l commented on June 1, 2024

Yes close, but I would either store the real iteration in current_i or rename it to current_dump/file/... because the name is confusing.

I can also provide a PR changing the content and usage of current_i at all places to correct it, but I did not want to disrupt parallel developments without prior notice via an issue.

from openpmd-viewer.

RemiLehe avatar RemiLehe commented on June 1, 2024

How about doing the following changes:

  • replacing current_i by _current_i
  • adding a new attribute current_iteration. This would be more consistent then current_i, since for instance the get_particle and get_field API has t and iteration as arguments (hence current_t and current_iteration)

from openpmd-viewer.

RemiLehe avatar RemiLehe commented on June 1, 2024

If you are fine with the above, you can definitely implement it and do the corresponding PR.

from openpmd-viewer.

ax3l avatar ax3l commented on June 1, 2024

sorry for the late reply since I work-arounded the problem and it then suddenly fall in priority behind in the end-of-year madness.

I think it's a great idea to add an explicit

  • current_iteration

for naming & interface consistency.
I would suggest we rename current_i to current_dump or even better current_file_index to make it self-explanatory, too. We can still _hide it if you want.

from openpmd-viewer.

RemiLehe avatar RemiLehe commented on June 1, 2024

Thanks for the above comments. I agree with all of the above, and I slightly prefer current_file_index over current_dump.
You can go ahead with a PR if you have the time. Otherwise, I'll do it at some point later.

from openpmd-viewer.

RemiLehe avatar RemiLehe commented on June 1, 2024

Closed by #164

from openpmd-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.