Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PUTGET


Code Block
languagepy
dbEntry = imas.db_entry(imasdef.MDSPLUS_BACKEND, db_name, 3333, 3333)
dbEntry.create()  
    
ids = pf_active()
ids.ids_properties.homogeneous_time = 2

ids.put(db_entry = dbEntry)
dbEntry.close()



Code Block
languagepy
dbEntry = imas.db_entry(imasdef.MDSPLUS_BACKEND, db_name, 3333, 3333)
dbEntry.create()  

ids = pf_active()


ids.get(db_entry = dbEntry)
dbEntry.close()



Importing IDS classes

Suggested method:

Code Block
import imas
ids_wall = imas.wall()

It is also possible to write:

Code Block
import imas
from imas.wall import wall
ids_wall = wall()

or

Code Block
import imas
ids_wall = imas.wall.wall()


TO DO / Open points

IDS superclass

...

Code Block
ids = dbEntry.get(Wall.__name__)

Importing IDS classes

  • IDSes are defined in modules (files) corresponding to their names (e.g.  class wall defined in wall.py)
  • A correct usage is
    • from imas import wall;   ids_wall = wall.wall()
    • from imas.wall import wal; ids_wall = wall()
  • lt could be make easier for user adding import in imas __init__.py  (from wall import wall)
    • __init__.py has to be generated based on IDSDef.xml to add from <ids> import <ids>
    • user can use simpler form: "ids_wall = wall()" without doing any explicit imports
Code Block
Suggestion from Olivier:

could all specific IDS type modules be imported to a front end 'ids' module? so users would do:
wall = ids.wall()
instead of proposed
wall = wall.wall()also this would allow for 'exploring' the available IDS types, while is users need to import module per IDS type user need to know the exact list of types available for a given version

Answer: Requested schema cannot be implemented without breaking backward compatibility due to name clash

Explanation:

  • existing imas.ids is a class (container keeping all IDSes as attributes)
    • it will be not used in new 'scenario' but
    • it should be kept for backward compatibility
    • BTW the issue results from bad decisions took at design time
      • ids class is container for IDSes so its name doesn't correspond to its role
      • according to Py naming convention ids class should be named using capital letters - so IDS 
  • proposed - imas/ids is a package (module/directory) keeping all IDS classes ( <ids>.py)
  • once initialised ids object cannot be both: class and module at the same time

...

)