idstools.idsperf

Module Contents

idstools.idsperf.byte_size(obj)[source]

Calculates recursively the approximated size of data of an IDS or its sub-structures. Does not take into account the overhead of the various containers.

Parameters:
obj

object from which data size is being measured

Returns:

S – estimated data size in bytes

Return type:

int

idstools.idsperf.get_ids(db, idsname, occ=0, times=None, interp=imas.ids_defs.PREVIOUS_INTERP, verbose=False, dd_update=False)[source]

The function get_ids reads an IDS from a given DBEntry, either the entire IDS or slices at selected times, and returns the IDS object or a list of IDS slices.

Parameters:
db

The db parameter is an imas.DBEntry object, which represents an open data-entry for which the IDS will be read from. This object provides access to the data stored in the IMAS database.

idsname

The idsname parameter is a string that represents the name of the IDS that you want to read from the database.

occ=0

The occ parameter is the occurrence number of the IDS to be read. It is an optional parameter and its default value is 0.

times=None

A list of times at which to read a single slice of the IDS. If this parameter is not provided or set to None, the function will read the entire IDS.

interp=imas.ids_defs.PREVIOUS_INTERP

The interp parameter is an optional parameter that specifies the slicing interpolation mode. It determines how the data is interpolated when reading a single slice at a specific time. The default value is imas.ids_defs.PREVIOUS_INTERP, which means that the data is interpolated using the previous time slice

verbose=False

Verbose information

Returns:

either a full IDS object or a list of slices of an IDS object.

idstools.idsperf.get_timings(db, idsname, occ=0, dbout=None, times=None, repeat=5, verbose=False, profile=False, dd_update=False)[source]

The function get_timings performs timing measurements for various I/O operations on an IDS in an IMAS database.

Parameters:
db

The db parameter is an imas.DBEntry object, which represents an open data-entry for which the IDS will be read from.

idsname

The idsname parameter is a string that represents the name of the IDS to be read from the database.

occ=0

The occ parameter is the occurrence number of the IDS to be read. It specifies which occurrence of the IDS to read from the database. By default, it is set to 0, which means the first occurrence. Defaults to 0

dbout=None

The dbout parameter is an optional argument that specifies the output database where the IDS will be written to. If dbout is provided, the IDS will be written to the specified database.

times=None

The times parameter is a list of times at which to read a single slice of the IDS. If times is set to None, the entire IDS will be read.

repeat=5

The repeat parameter specifies the number of timings being measured. It allows for collecting statistics by repeating the timing measurement multiple times. Defaults to 5

verbose=False

Verbose information

profile=False

A boolean parameter that determines whether or not to print additional information by running the command under cProfile.

Returns:

The function get_timings returns a list of timing measurements. The length of the list is equal to the repeat parameter, which specifies the number of timings being measured. Each timing measurement represents the time taken to perform the specified I/O operation for the IDS.