Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to simplify data access by exposing common DataConnection getters directly on the params objects, then refactors existing code and examples to use the shorter params.get_* calls (with repo-wide reformatting/linting applied).
Changes:
- Add
get_data,get_data_with_dims, andget_dimsdelegators toPhysicsMethodParams. - Refactor multiple tokamak physics/EFIT modules and docs examples to call getters via
paramsinstead ofparams.data_conn. - Update time-setting implementations to use the new
params.get_*style.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/examples/custom_time_setting.py | Updates custom time-setting example to use params.get_dims. |
| docs/examples/custom_physics_method.py | Updates example physics method to use params.get_data. |
| disruption_py/settings/time_setting.py | Refactors time-setting retrieval to use params.get_* getters. |
| disruption_py/machine/mast/physics.py | Refactors MAST physics retrieval to use params.get_data. |
| disruption_py/machine/mast/efit.py | Refactors MAST EFIT retrieval to use params.get_data. |
| disruption_py/machine/hbtep/physics.py | Refactors HBT-EP physics retrieval to use params.get_data_with_dims/get_dims/get_data. |
| disruption_py/machine/east/physics.py | Refactors EAST physics retrieval to use params.get_data_with_dims/get_dims/get_data. |
| disruption_py/machine/east/efit.py | Refactors EAST EFIT retrieval to use params.get_data. |
| disruption_py/machine/d3d/util.py | Refactors D3D utility getter use to params.get_data. |
| disruption_py/machine/d3d/physics.py | Refactors D3D physics retrieval to use params.get_* and updates a tree-name lookup call. |
| disruption_py/machine/d3d/efit.py | Refactors D3D EFIT retrieval to use params.get_data. |
| disruption_py/machine/cmod/thomson.py | Refactors CMOD Thomson retrieval to use params.get_* for several signals. |
| disruption_py/machine/cmod/physics.py | Refactors CMOD physics retrieval to use params.get_*. |
| disruption_py/machine/cmod/efit.py | Refactors CMOD EFIT retrieval to use params.get_data/get_dims. |
| disruption_py/core/physics_method/params.py | Adds delegating getter methods to PhysicsMethodParams. |
Comments suppressed due to low confidence (1)
disruption_py/settings/time_setting.py:343
TimeSettingParamscurrently has noget_data_with_dimsmethod; this will fail at runtime when computing the D3D disruption timebase. Useparams.data_conn.get_data_with_dims(...)or add a delegatingget_data_with_dimsmethod toTimeSettingParams.
raw_ip, ip_time = params.get_data_with_dims(f"ptdata('ip', {params.shot_id})")
ip_time = ip_time / 1.0e3
baseline = np.mean(raw_ip[:10])
ip = raw_ip - baseline
return self._calculate_disruption_times(params, ip, ip_time)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Do you want to add a shortcut to |
|
not right now, as that's a method of MDSplus connections only, but not xarray. |
paramsitself,params.data_connshortcuts,params,since we are now shortening data getter calls by 10 chars, many files got changed with nontrivial changes by
black.I made sure to push atomic commits for easier review!