Easier accessibility to key values
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 71
- Forks
- 27
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 33
Description
I am interested in determining whether there is a simpler method to directly access and print specific variable values from the results, without the need to manually open the OUT.DAT file. While I am aware of methods to display key output variables, such as:
print(f"Heat transport system: {single_run.models.costs.c226:.3e} M$")
print(f"Electrical plant equipment: {single_run.models.costs.c24:.3e} M$")
these require detailed knowledge of the entire data structure to accurately reference and print the desired variables. For instance, if I want to view only a few specific variables like rmajor, rminor, q0, beta_n, and Q-value, I would need to search through the data structure to identify the correct paths to print these values.
Currently, using the following approach:
runs_metadata = [
RunMetadata(data_dir / "large_tokamak_1_MFILE.DAT", "large tokamak 1"),
]
# Figure and dataframe returned for optional further modification
fig1, df1 = plot_mfile_solutions(
runs_metadata=runs_metadata,
plot_title="Large tokamak solution 1",
)
df1
results are typically presented as figures or tables, which does not provide direct access to individual variable values.
It would be highly beneficial to have a more straightforward method to access and print specific key result variables, such as runs_metadata.rmajor, runs_metadata.thwcndut, and others. This would significantly enhance the usability and efficiency of working with the data. I hope there would be a function that can convert OUT.DAT data into dictionary or class type structure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the RunMetadata and plot_mfile_solutions entry points, then trace how OUT.DAT and MFILE.DAT results become figures or dataframes. Compare the requested rmajor, rminor, q0, beta_n, and Q-value access patterns with the existing costs examples. Done should be a documented, consistent way to retrieve selected result variables without manually discovering nested paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, data-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100