Skip to content

Issue318 add synth diag ids#319

Merged
lasofivec merged 6 commits intodevelfrom
Issue318_AddSynthDiagIds
Dec 11, 2019
Merged

Issue318 add synth diag ids#319
lasofivec merged 6 commits intodevelfrom
Issue318_AddSynthDiagIds

Conversation

@Didou09
Copy link
Copy Markdown
Member

@Didou09 Didou09 commented Dec 9, 2019

Motivations:

  • For non-experienced users, the imas interface class MultiIDSLoader shall provide an easy way to:
    • load diagnostics geometries
    • load experimental diagnostic data
    • load all ids necessary to compute synthetic signal for a given diagnostic
  • The current status allowed to do that in ~5-6 lines, provided the user knows where to get the info
  • This need being a typical use-case, it should be easier / faster

Main changes:

  • All diagnostocs for which a synthetic diagnostic exists are tabulated inside the class hidden attributes, along with their corresponding ids (core_profiles...)
  • A method allows to instantaneously get the ids necessary for synthetic data (get_input_for_synthdiag())
  • A method, add_ids_synthdiag(), calls the previous to automatically add and load then necessary ids, if necessary with a custom idd defined just-in-time.
  • Two keywords added at instanciation (ids_base and synthdiag) for users who want to load everythong at once from a single idd)
  • (extra) a get_events() method is implemented to easily print the chronologial events in a shot from ids 'pulse_schedule'

Issues:

Example (with a custom idd):

Before (5 lines, a bit complicated)

> import tofu as tf

# load experimental data and wall for geometry, and pulse_schedule for tIGNITRON
> multi = tf.imas2tofu.MultiIDSLoader(shot=53259, ids=['pulse_schedule', 'wall', 'interferometer'], get=False)

# Find which ids are necessary for synthetic signal calculation
> print(multi._didsdiag['interferometer']['synth']['dsig'])
{'core_profiles': ['t', '1dne', '1drhotn'],
 'equilibrium': ['t', '2drhotn', '2dmeshNodes', '2dmeshFaces']}

# add these ids to multi
> multi.add_ids(ids=['core_profiles', 'equilibrium'], shot=53259, user='CB165101', run=1, get=False)

# Load everything that was added
> multi.open_get_close()

# Calculate signal
> sig = multi.calc_signal('interferometer')

Now (3 lines, simpler)

> import tofu as tf

# load experimental data (wall and pulse_schedule are automatically included)
> multi = tf.imas2tofu.MultiIDSLoader(shot=53259, ids='interferometer', get=False)

# Add ids necessary for calculation (automatically identified: tabulated in class attribute)
> multi.add_ids_synth_diag(shot=53259,  user='CB165101', run=1)

# Calculate signal
> sig = multi.calc_signal('interferometer')

Also, events can now be obtained using (will only work if 'pulse_schedule' was properly populated):
> multi.get_events()

@pep8speaks
Copy link
Copy Markdown

pep8speaks commented Dec 9, 2019

Hello @Didou09! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-12-09 14:21:08 UTC

Comment thread tofu/imas2tofu/_core.py
@lasofivec lasofivec merged commit 5100bae into devel Dec 11, 2019
@lasofivec lasofivec deleted the Issue318_AddSynthDiagIds branch December 11, 2019 19:08
@Didou09 Didou09 mentioned this pull request Jan 30, 2020
@Didou09 Didou09 mentioned this pull request Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants