Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] File Importing #785

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

proy30
Copy link
Contributor

@proy30 proy30 commented Jan 7, 2025

This PR allows users to upload .py simulation files and have the dashboard auto-populate inputs based on sim file info. The parser currently expects input files to be structured in the same structure as the dashboard export files.

Current limitations:

  • prob_relative cannot yet be parsed correctly without it's functionality modified to preserve values when max_level is modified.
  • lattice element configurations in impactx examples are built in a variety of ways (ie. referencing variables for different parameters, loading in madx file, utilizing combination of sim.lattice.extend and sim.lattice.append). The initial parser is limited - can only correctly all extract elements if the input file is structured similar to the export file.

Merge after #780

Takes care of #668

@proy30 proy30 added the component: dashboard our browser based trame dashboard label Jan 7, 2025
@proy30 proy30 self-assigned this Jan 7, 2025
@proy30 proy30 changed the title [Draft] File Importing for dashboard [Draft] File Importing Jan 7, 2025
to the dashboard and auto-populate the UI with their configurations.
"""

def file_details(file) -> None:

Check notice

Code scanning / CodeQL

First parameter of a method is not named 'self' Note

Normal methods should have 'self', rather than 'file', as their first parameter.
elif file_size_in_bytes < 1024 * 1024:
size_str = f"{file_size_in_bytes/1024:.1f} KB"

state.import_file_details = f"({size_str}) {file['name']}"

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable Error

Local variable 'size_str' may be used before it is initialized.

state.import_file_details = f"({size_str}) {file['name']}"

def parse_impactx_simulation_file(file) -> None:

Check notice

Code scanning / CodeQL

First parameter of a method is not named 'self' Note

Normal methods should have 'self', rather than 'file', as their first parameter.

return parsed_values_dictionary

def populate_impactx_simulation_file_to_ui(file) -> None:

Check notice

Code scanning / CodeQL

First parameter of a method is not named 'self' Note

Normal methods should have 'self', rather than 'file', as their first parameter.
@proy30 proy30 marked this pull request as draft January 8, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dashboard our browser based trame dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant