Versions Compared

Key

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

...

Code Block
languagepy
titleIDS GET
def get_slice(self, ids_name, time_requested, interpolation_method, occurrence=0): # idsName (e.g. 'equilibrium')
	return ids

Any other method is needed to ba added to DBEntry class?

def delete(self, ids_name, occurrence=0):


IDS superclass

IDSBase  - Parent class for all classes representing particular IDSes

Class  methods (aka "static")

def get_ids(cls, ids_name):

. For internal use only - it should not be called by users.

IDS class

Warning
titleBackward compatibility

Backward compatibility, understood as possibility of using 'old' and 'new' approach at the same time is kept:

(plus) All 'old' scripts will work - no modifications needed 

(minus) Currently all methods use context kept in IDS that was a reason of many problems. New API is designed to overcome this issue. Keeping compatibility means that methods still have to be able to use context stored in IDS that is error prone.

(minus) All unwanted, messy methods operating on context stored (setCtx, etc)  must be kept 


Compatibility can be also ensured by introducing new names of methods - putSlice  vs put_slice 

Class  methods (aka "static")

Code Block
def get_max_occurrences(cls): def read_time_mode(self, ctx): def read_time(self, ctx):

IDS storing / reading

DBEntry  is used to provide explicitly context to methods. This parameter is optional to keep backward compatibility....

...

Code Block
def put(self, occurrence=0, db_entry=None):

def get(self, occurrence=0, db_entry=None):

def putSlice(self, occurrence=0, db_entry=None):

def getSlice(self, time_requested, interpolation_method, occurrence=0, db_entry=None):

Additional methods

code
def copy_values(self, ids):

def delete_data(self, occurrence=0, db_entry=None ):

def partial_get(self, dataPath, occurrence=0, db_entry=None):

def get_field(self, dataPath, occurrence=0, db_entry=None):

"Messy" methods

... that are not in line with proposed design but they must be kept to ensure backward compatibility.

...

Backward compatibility

PUTGET


Code Block
  import imas

  imasEnv = imas.ids(1111, 1111)
  imasEnv.create_env(user, db_name, dd_version)  
    
  # Mandatory property
  imasEnv.pf_active.ids_properties.homogeneous_time = 2

  imasEnv.pf_active.put()
        
  imasEnv.close()



Code Block
import imas

imasEnv = imas.ids(1111, 1111)
imasEnv.open_env(user, db_name, dd_version)  




imasEnv.pf_active.get()
  
imasEnv.close()


...

PUTGET


Code Block
languagepy
import imas
db_entry = imas.DBEntry(imasdef.MDSPLUS_BACKEND, db_name, 2222, 2222)
db_entry.create()  
    
ids = imas.pf_active()
# Mandatory property
ids.ids_properties.homogeneous_time = 2

db_entry.put(ids)

db_entry.close()



Code Block
languagepy
import imas
db_entry = imas.DBEntry(imasdef.MDSPLUS_BACKEND, db_name, 2222, 2222)
db_entry.open()  





ids = db_entry.get('pf_active')

db_entry.close()


...

PUTGET


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

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



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

ids = imas.pf_active()


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

...



IDS

...

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()

IDS names

Code Block
ids = db_entry.get('pf_active')

...

     EQUILIBRIUM = 'equilibrium'

     WALL = 'wall' etc etc


Code Block
class IDSName(enum): 
     AMNS_DATA = 'amns_data'
     ......
     WAVES = 'waves' 



Code Block
from ids_names import IDSName

ids = db_entry.get(IDSName.WALL)

...