Ejemplo n.º 1
0
def test_cache():
    cached_file = os.sep.join(webapi.__file__.split(os.sep)[:-1] +\
                  ['cached','archivedb_codac_w7x_cbg_ecrh_totalpower_datastream'+
                   '_v1_0_ptot_ecrh_scaled_-20181016.037.hdf5'])
    existed = os.path.exists(cached_file)
    if existed is True:
        print("Can't properly test data caching, file already exists")
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    d = flap.get_data(
        'W7X_WEBAPI',
        name=
        'ArchiveDB/codac/W7X/CBG_ECRH/TotalPower_DATASTREAM/V1/0/Ptot_ECRH/scaled/',
        exp_id='20181016.037',
        options={
            'Scale Time': True,
            'Cache Data': True
        },
        object_name='ECRH_data',
        coordinates={'Time': [2, 3]})
    exists = os.path.exists(cached_file)
    if not existed:
        os.remove(cached_file)
    return exists
Ejemplo n.º 2
0
def test_reading():
    flap.register_data_source('JET_API',
                              get_data_func=jetapi.get_data,
                              add_coord_func=jetapi.add_coordinate)
    ky6 = flap.get_data('JET_API', name='JPF/DH/Y6-EMITER<VLT',
                      exp_id=95531,
                      object_name='JPF Voltage', options={})
    return int(np.mean(ky6.data))
Ejemplo n.º 3
0
def test_downsampling():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    d = flap.get_data('W7X_WEBAPI',
                      name='NBI-7',
                      exp_id='20181016.037',
                      options={
                          'Scale Time': True,
                          'Downsample': 1024,
                          'Cache Data': False
                      },
                      object_name='ECRH_data')
    return d.coordinates[0].shape
Ejemplo n.º 4
0
def test_reading():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    d = flap.get_data('W7X_WEBAPI',
                      name='ECRH',
                      exp_id='20180912.012',
                      options={
                          'Scale Time': True,
                          'Check Time Equidistant': True,
                          'Cache Data': False
                      },
                      object_name='ECRH_data')
    return [d.coordinates[0].mode.equidistant, d.coordinates[0].start]
Ejemplo n.º 5
0
def test_imagedata():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    d = flap.get_data('W7X_WEBAPI',
                      name='AUG-2',
                      exp_id='20181016.037',
                      options={
                          'Scale Time': True,
                          'Cache Data': False
                      },
                      object_name='AUG2_data',
                      coordinates={'Time': [2, 3]})
    return np.mean(d.data)
Ejemplo n.º 6
0
def test_timerange():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    d = flap.get_data(
        'W7X_WEBAPI',
        name=
        'ArchiveDB/codac/W7X/CBG_ECRH/TotalPower_DATASTREAM/V1/0/Ptot_ECRH/scaled/',
        exp_id='20181016.037',
        options={
            'Scale Time': True,
            'Cache Data': False
        },
        object_name='ECRH_data',
        coordinates={'Time': [2, 3]})
    return [d.coordinates[0].values[0], d.coordinates[0].values[-1]]
Ejemplo n.º 7
0
def test_vectordata():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    #    d = flap.get_data('W7X_WEBAPI', name='TS-v8-ne_map',

    d = flap.get_data('W7X_WEBAPI',
                      name='ABES-v2-density',
                      exp_id='20181016.037',
                      options={
                          'Scale Time': True,
                          'Cache Data': False
                      },
                      object_name='ECRH_data',
                      coordinates={'Time': [0, 3]})
    return np.mean(d.data)
Ejemplo n.º 8
0
def register(data_source=None):
    if (data_source is None):
        data_source = 'TESTDATA'
    flap.register_data_source('TESTDATA',
                              get_data_func=testdata_get_data,
                              add_coord_func=add_coordinate)
Ejemplo n.º 9
0
def test_register():
    flap.register_data_source('W7X_WEBAPI',
                              get_data_func=webapi.get_data,
                              add_coord_func=webapi.add_coordinate)
    return 'W7X_WEBAPI' in flap.list_data_sources()
Ejemplo n.º 10
0
def test_register():
    flap.register_data_source('JET_API',
                              get_data_func=jetapi.get_data,
                              add_coord_func=jetapi.add_coordinate)
    return 'JET_API' in flap.list_data_sources()
Ejemplo n.º 11
0
def register():
    flap.register_data_source('NSTX_GPI',
                              get_data_func=nstx_gpi_get_data,
                              add_coord_func=add_coordinate)
Ejemplo n.º 12
0
def register(data_source='MDSPlus'):
    if (flap.VERBOSE):
        print("Importing flap_mdsplus for "+data_source)
    flap.register_data_source(data_source, get_data_func=mdsplus_get_data,
                              add_coord_func=add_coordinate)
Ejemplo n.º 13
0
def register(data_source=None):
    flap.register_data_source('W7X_CAMERA', get_data_func=w7x_camera_get_data)
Ejemplo n.º 14
0
def register(data_source=None):
    if (data_source is None):
        data_source = 'W7X_MDSPlus'
    flap.register_data_source(data_source,
                              get_data_func=w7x_mdsplus_get_data,
                              add_coord_func=add_coordinate)