Skip to content

[Issue335] description_2d propagated and set to 1 by default#336

Merged
Didou09 merged 4 commits intodevelfrom
Issue335_description2d
Jan 28, 2020
Merged

[Issue335] description_2d propagated and set to 1 by default#336
Didou09 merged 4 commits intodevelfrom
Issue335_description2d

Conversation

@Didou09
Copy link
Copy Markdown
Member

@Didou09 Didou09 commented Jan 27, 2020

Main changes:

  • The input keyword argument 'description_2d', used to choosed the wall geometry from an imas wall IDS, is now available from all methods of MultiIDSLoader that call to_Config() in the background. These include in particular to_Plasma2D(), to_Cam(), to_Data() and calc_signal()
  • When not set (description_2d=None), the variable is now automatocally set to 1 if possible (to 0 otherwise)

Example (on IRFM Intra only):

In [1]: import tofu as tf
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/imas2tofu/__init__.py:83: UserWarning: 
You do not seem to be using the latest IMAS version:
'module list' vs 'module av IMAS' suggests:
	- Current version: 3.23.1-4.0.3
	- Latest version : 3.25.0-4.4.0
  warnings.warn(msg)
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/__init__.py:95: UserWarning: 
The following subpackages are not available:
    - tofu.mag
  => see print(tofu.dsub[<subpackage>]) for details.
  warnings.warn(msg)

In [2]: multi = tf.imas2tofu.MultiIDSLoader(ids=['bolometer'], shot=55983, ids_base=True)
Getting ids     [occ]  tokamak  user         version  shot   run  refshot  refrun
--------------  -----  -------  -----------  -------  -----  ---  -------  ------
bolometer       [0]    west     imas_public  3        55983  0    -1       -1    
pulse_schedule  [0]    "        "            "        "      "    "        "     
wall            [0]    "        "            "        "      "    "        "     

In [3]: bolo = multi.to_Data('bolometer')

In [4]: bolo = multi.to_Data('bolometer', description_2d=0)
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/imas2tofu/_core.py:2350: UserWarning: 
ids wall has same number of limiter / mobile units
	- len(wall.description_2[0].limiter.unit) = 1
	- len(wall.description_2[0].mobile.unit) = 1
  => Choosing limiter by default
  warnings.warn(msg)

issues335

Issues:

Fixes, in devel, Issue #335

…_Data(), and set to 1 when possible by default
Comment thread tofu/imas2tofu/_core.py
@pep8speaks
Copy link
Copy Markdown

pep8speaks commented Jan 28, 2020

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 2020-01-28 12:42:09 UTC

Copy link
Copy Markdown
Collaborator

@lasofivec lasofivec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome ! :)

Comment thread tofu/imas2tofu/_core.py
description_2d=None, mobile=None, plot=True):
""" Export the content of wall ids as a tofu Config object

Choose the occurence (occ), and index (description_2d, cf. dd_doc) to
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is dd_doc ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an IMAS-specific documentation
Users of IMAS will know it, others won't, but anyway, this sub-package imas2tofu is to be used by IMAS users only, so they will know ;-)

Basically, to get the documentation on IMAS on the ITER clusters for example, you typically type dd_doc in a terminal (with the ritgh modules pre-loaded), and a web browser opens ndirectly on an IMAS documentation page

Comment thread tofu/imas2tofu/_core.py Outdated
Comment thread tofu/imas2tofu/_core.py
plot_sig: None / str
shortcut of the signal to be plotted, if any
plot_X: None / str
shortcut of the abscissa against which to plot the signal, if any
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does shortcut means here ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All data fields can be accessed by shortcuts, they are available via the method get_shortcuts() that displays them all, ordered by ids and signal.

For example:

 In [1]: import tofu as tf
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/imas2tofu/__init__.py:83: UserWarning: 
You do not seem to be using the latest IMAS version:
'module list' vs 'module av IMAS' suggests:
	- Current version: 3.23.1-4.0.3
	- Latest version : 3.25.0-4.4.0
  warnings.warn(msg)
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/__init__.py:95: UserWarning: 
The following subpackages are not available:
    - tofu.mag
  => see print(tofu.dsub[<subpackage>]) for details.
  warnings.warn(msg)

In [2]: multi = tf.imas2tofu.MultiIDSLoader(ids=['bolometer'], shot=55983, synthdiag=True)
Getting ids     [occ]  tokamak  user         version  shot   run  refshot  refrun
--------------  -----  -------  -----------  -------  -----  ---  -------  ------
bolometer       [0]    west     imas_public  3        55983  0    -1       -1    
core_sources    [0]    "        "            "        "      "    "        "     
equilibrium     [0]    "        "            "        "      "    "        "     
ual_begin_arraystruct_action: %TREE-W-NNF, Node Not Found (ual_lowlevel.cpp:719)
        => failed !
pulse_schedule  [0]    "        "            "        "      "    "        "     
wall            [0]    "        "            "        "      "    "        "     
/Home/DV226270/ToFu_All/tofu_git/tofu/tofu/imas2tofu/_core.py:1200: UserWarning: ERROR: ual_begin_arraystruct_action failed for "grids_ggd"
  warnings.warn(str(err))

In [3]: multi.get_shortcuts()
ids             shortcut      long version                                                             
--------------  ------------  -------------------------------------------------------------------------
bolometer       etendue       channel[chan].etendue                                                    
bolometer       los_pt1Phi    channel[chan].line_of_sight.first_point.phi                              
bolometer       los_pt1R      channel[chan].line_of_sight.first_point.r                                
bolometer       los_pt1Z      channel[chan].line_of_sight.first_point.z                                
bolometer       los_pt2Phi    channel[chan].line_of_sight.second_point.phi                             
bolometer       los_pt2R      channel[chan].line_of_sight.second_point.r                               
bolometer       los_pt2Z      channel[chan].line_of_sight.second_point.z                               
bolometer       los_ptsRZPhi  f( los_pt1R, los_pt1Z, los_pt1Phi, los_pt2R, los_pt2Z, los_pt2Phi )      
bolometer       names         channel[chan].name                                                       
bolometer       power         channel[chan].power.data                                                 
bolometer       prad          power_radiated_total                                                     
bolometer       pradbulk      power_radiated_inside_lcfs                                               
bolometer       t             channel[chan].power.time                                                 
bolometer       tpower        time                                                                     
core_sources    1dbrem        source[identifier.name=bremsstrahlung].profiles_1d[time].electrons.energy
core_sources    1dline        source[identifier.name=lineradiation].profiles_1d[time].electrons.energy 
core_sources    1dprad        f( 1dbrem, 1dline )                                                      
core_sources    1dpsi         source[identifier.name=lineradiation].profiles_1d[time].grid.psi         
core_sources    1drhopn       f( 1dpsi )                                                               
core_sources    1drhotn       source[identifier.name=lineradiation].profiles_1d[time].grid.rho_tor_norm
core_sources    t             time                                                                     
equilibrium     1djT          time_slice[time].profiles_1d.j_tor                                       
equilibrium     1dpe          time_slice[time].profiles_1d.pressure                                    
equilibrium     1dphi         time_slice[time].profiles_1d.phi                                         
equilibrium     1dpsi         time_slice[time].profiles_1d.psi                                         
equilibrium     1dq           time_slice[time].profiles_1d.q                                           
equilibrium     1drhopn       f( 1dpsi, psiaxis, psisep )                                              
equilibrium     1drhotn       time_slice[time].profiles_1d.rho_tor_norm                                
equilibrium     2dB           f( 2dBT, 2dBR, 2dBZ )                                                    
equilibrium     2dBR          time_slice[time].ggd[0].b_field_r[0].values                              
equilibrium     2dBT          time_slice[time].ggd[0].b_field_tor[0].values                            
equilibrium     2dBZ          time_slice[time].ggd[0].b_field_z[0].values                              
equilibrium     2djT          time_slice[time].ggd[0].j_tor[0].values                                  
equilibrium     2dmeshFaces   grids_ggd[0].grid[0].space[0].objects_per_dimension[2].object[].nodes    
equilibrium     2dmeshNodes   grids_ggd[0].grid[0].space[0].objects_per_dimension[0].object[].geometry 
equilibrium     2dmeshR       time_slice[0].profiles_2d[0].r                                           
equilibrium     2dmeshZ       time_slice[0].profiles_2d[0].z                                           
equilibrium     2dphi         time_slice[time].ggd[0].phi[0].values                                    
equilibrium     2dpsi         time_slice[time].ggd[0].psi[0].values                                    
equilibrium     2drhopn       f( 2dpsi, psiaxis, psisep )                                              
equilibrium     2drhotn       f( 2dphi )                                                               
equilibrium     2dtheta       f( axR, axZ, 2dmeshNodes )                                               
equilibrium     BT0           time_slice[time].global_quantities.magnetic_axis.b_field_tor             
equilibrium     ax            f( axR, axZ )                                                            
equilibrium     axR           time_slice[time].global_quantities.magnetic_axis.r                       
equilibrium     axZ           time_slice[time].global_quantities.magnetic_axis.z                       
equilibrium     ip            time_slice[time].global_quantities.ip                                    
equilibrium     psiaxis       time_slice[time].global_quantities.psi_axis                              
equilibrium     psisep        time_slice[time].global_quantities.psi_boundary                          
equilibrium     q0            time_slice[time].global_quantities.q_axis                                
equilibrium     q95           time_slice[time].global_quantities.q_95                                  
equilibrium     qmin          time_slice[time].global_quantities.q_min.value                           
equilibrium     sep           f( sepR, sepZ )                                                          
equilibrium     sepR          time_slice[time].boundary_separatrix.outline.r                           
equilibrium     sepZ          time_slice[time].boundary_separatrix.outline.z                           
equilibrium     strike0       f( strike0R, strike0Z )                                                  
equilibrium     strike0R      time_slice[time].boundary.strike_point[0].r                              
equilibrium     strike0Z      time_slice[time].boundary.strike_point[0].z                              
equilibrium     strike1       f( strike1R, strike1Z )                                                  
equilibrium     strike1R      time_slice[time].boundary.strike_point[1].r                              
equilibrium     strike1Z      time_slice[time].boundary.strike_point[1].z                              
equilibrium     t             time                                                                     
equilibrium     volume        time_slice[time].global_quantities.volume                                
equilibrium     x0            f( x0R, x0Z )                                                            
equilibrium     x0R           time_slice[time].boundary.x_point[0].r                                   
equilibrium     x0Z           time_slice[time].boundary.x_point[0].z                                   
equilibrium     x1            f( x1R, x1Z )                                                            
equilibrium     x1R           time_slice[time].boundary.x_point[1].r                                   
equilibrium     x1Z           time_slice[time].boundary.x_point[1].z                                   
pulse_schedule  events        f( events_names, events_times )                                          
pulse_schedule  events_names  event[].identifier                                                       
pulse_schedule  events_times  event[].time_stamp                                                       
wall            wall          f( wallR, wallZ )                                                        
wall            wallR         description_2d[0].limiter.unit[0].outline.r                              
wall            wallZ         description_2d[0].limiter.unit[0].outline.z     

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this because accessing data in an IMAS ids can be cumbersome since the path to it can be long and not always intuitive.
So each long path has a shortcut.
Most are predefined but the user can customize them if he wants to define his/her own shortcuts. Koyo did it for example in issue #218

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I imagined it was this but I rather keep a record of the answer. Plus I didn't know shortcuts were also for the abscissa for example

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 28, 2020

Codecov Report

Merging #336 into devel will decrease coverage by <.01%.
The diff coverage is 12.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel     #336      +/-   ##
==========================================
- Coverage   40.02%   40.02%   -0.01%     
==========================================
  Files          79       79              
  Lines       24132    24134       +2     
==========================================
  Hits         9659     9659              
- Misses      14473    14475       +2
Impacted Files Coverage Δ
tofu/imas2tofu/_core.py 0.67% <0%> (-0.01%) ⬇️
tofu/version.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 822c9da...5b11c7b. Read the comment docs.

@Didou09 Didou09 merged commit 0840bdc into devel Jan 28, 2020
@Didou09 Didou09 deleted the Issue335_description2d branch January 28, 2020 13:21
@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.

4 participants