Versions Compared

Key

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

...

Creating a new Data Entry using the MDS+ backend:

  • consists in creating a new (MDS+) pulse file on the disk

...

  • requires to have an existing 'database' (e.g a directory when using the MDS+ backend) which will host the new pulse file

So, let's first create a new database named 'data_access_tutorial' which will belong to the

In the Data Entry creation process, you will have to specified the name of a database which ha

Before to be able to create a pulse file, you need to 

Since the pulse file will be created in a directory,   

Therefore, you need to have write permissions for the database specified in the create() command.

So, let's first create a new database belonging to the current user.

From a new shell, execute the following command:

Code Block
module load IMAS
imasdb data_access_tutorial

We can check that the database has been successfully created:

Code Block
$ ls -alh ~/public/imasdb/data_access_tutorial/
total 2.5K
drwxrwsr-x  3 fleuryl fleuryl 4.0K Aug 31 10:09 .
drwxrwsr-x 14 fleuryl fleuryl 4.0K Aug 31 10:09 ..
drwxrwsr-x 13 fleuryl fleuryl 4.0K Sep 13 11:16 3

Now, the following code will create a new MDS+ pulse file for shot=15000, run=1 in the 'data_access_tutorial' database of the current user:

Code Block
import imas
import getpass
from imas import imasdef

#creates the Data Entry object 'data_entry' associated to the pulse file with shot=15000, run=1, belonging to database 'pcss_tutorial' of the current user, using the MDS+ backend
data_entry = imas.DBEntry(imasdef.MDSPLUS_BACKEND, 'data_access_tutorial, 15000, 1, user_name=getpass.getuser())

#creates the pulse file associated to the Data Entry object 'data_entry' previously created
data_entry.create()

#here, we can perform some read/write operations using the get/put() operations
#...

#closes the data_entry
data_entry.close()

...