Using data source modules

In the example below we will use module name testdata and data source name ‘TESTDATA’.[1]

To make use of a data source module it should be first imported in the user program as any other module.

import flap.testdata
Warning: could not read configuration file 'flap_defaults.cfg'.
Default location of configuration file is working directory.
INIT flap storage

To make use of a data source module it should be first imported in the user program as any other module. The data read and coordinate add functions are integrated into FLAP by calling the register function of the data source.

flap.testdata.register()

The flap.list_data_sources function lists all actually registered data sources:

print(flap.list_data_sources())
['TESTDATA']

The flap.get_data() function is the general data read interface in FLAP. In this example it reads from the ‘TESTDATA’ data source. The data named ‘TEST-1-1’, ‘TEST-1-5’, …, ‘TEST-1-8’ are read.

The resulting data object will be stored in FLAP storage under name ‘TESTDATA_SIGNALS’ and also returned by the function.

In the options it is requested to scale the data to Volts.

d=flap.get_data('TESTDATA',
                name=['TEST-1-1','TEST-1-[5-8]'],
                options={'Scaling':'Volt'},\
                object_name='TESTDATA_SIGNALS')

View the data object now in flap_storage:

_ = flap.list_data_objects()
-----------------------------
TESTDATA_SIGNALS(data_source:"TESTDATA" exp_id:"") data_title:"Test data" shape:[5,100001][no error]
  Data name:"Signal", unit:"Volt"
  Coords:
Time [Second](Dims:1) [<Equ.><R. symm.>] Start:  0.000E+00, Steps:  1.000E-06
Sample [a.u.](Dims:1) [<Equ.><R. symm.>] Start:  0.000E+00, Steps:  1.000E+00
Signal name [a.u.](Dims:0), Shape:[5]) [<R. symm.>] Val:TEST-1-1, TEST-1-5, TEST-1-6, TEST-1-7, TEST-1-8
Column [a.u.](Dims:0), Shape:[5]) [<R. symm.>] Val:1, 1, 1, 1, 1
Row [a.u.](Dims:0), Shape:[5]) [<R. symm.>] Val:1, 5, 6, 7, 8