impactx icon indicating copy to clipboard operation
impactx copied to clipboard

Dashboard: Add impactx examples

Open proy30 opened this issue 9 months ago • 4 comments

Dashboard users can now pick and choose which ImpactX example to load on the dashboard. Serves as a great user feature and a good testing functionality to evaluate the performance of the dashboard parser and it's ability to handle various types of inputs.

While users can now select any impactx example, the dashboard parser needs updating for more flexibility in reading different types of file formats and the addition of variable referencing for the lattice configuration (https://github.com/BLAST-ImpactX/impactx/pull/829) needs to be completed for better usage.

TODO:

  • [ ] Merge #930
  • [ ] Merge ...

proy30 avatar Mar 07 '25 00:03 proy30

https://github.com/user-attachments/assets/cfeb8ec1-10f9-495b-a4e3-a023920c97f9

proy30 avatar Mar 07 '25 00:03 proy30

Another touchup PR could focus on giving users better selection options.. following something similar to:

https://impactx.readthedocs.io/en/latest/usage/examples.html

For example in the dropdown:

Space Charge

  • [All examples of space charge examples]

CSR

  • [All examples of CSR]

etc..

I notice an issue right away with an example such as cfchannel/run_cfchannel_10nC_fft.py. Would be nice if sc was included in the file name to indicate this is a space charge example, as would making parsing easier.

proy30 avatar Mar 07 '25 00:03 proy30

This is really cool, but since examples can use arbitrary syntax my feeling is that this can be hard to maintain... e.g., the BeamMonitor in the examples is usually a separate variable, and we can write arbitrary functions to create lattices or particle input...

One way that would be easier to maintain, but is different than your current approach, would be to only read examples from their "inputs" (executable/app) files, because that is a simple key-value syntax that can easily be parsed.

To discuss :)

ax3l avatar Mar 08 '25 05:03 ax3l

Discussed today: simplifying to an allow-list of explicitly working examples (e.g., the most common 5-20 that fully work) would be sufficient and create no confusion.

ax3l avatar Mar 21 '25 16:03 ax3l

@proy30 if you rebase this PR, is it ready to review/merge? :)

ax3l avatar Jul 10 '25 18:07 ax3l

@ax3l The current dashboard parser isn’t reliable enough to accurately load all of the initial set of ImpactX examples we selected for the dashboard.

I worked on a branch over a month (or two) ago that improves things — it successfully imports most of those examples (only iotalattice.py I believe is still failing), but it’s not fully robust. From what I’ve seen online, using an ast-based approach (https://docs.python.org/3/library/ast.html) would be a better long-term solution, but it would require a full refactor of what I have, which I haven’t had time to do yet.

We could merge the parser improvements I have now and move forward with this PR. I have to rebase it and touch up on a couple of points and then make a PR for it. Just a heads-up that we would definitely need a follow-up PR to update the parser again.

proy30 avatar Jul 10 '25 18:07 proy30

Ok. I mean what we should generally do is some try-catch parsing that simply skips examples from the list in the GUI that throw errors in parsing. Can you add that logic?

Then we can see if we restructure a few examples that fail and others that are not parsable easily we simply skip in the GUI.

ax3l avatar Jul 10 '25 19:07 ax3l

Yes I am @cemitch99. a note is that some of the examples that are in this PR might not be supported even with the changes in #1140. I will update the list of supported examples in #1140.

1140 will be complete within the next week.

Edit:

The core funcitonality of this PR (allowing the use of examples) is what makes the PR "ready". Now it is on #1140 to make the parsing correct.

proy30 avatar Sep 19 '25 17:09 proy30