Пример #1
0
def create_instruments():
    
    from dataflow.modules import load
    load.DATA_SOURCES = config.data_sources

    if config.use_redis == True:
        redis_params = getattr(config, "redis_params", {})
        use_redis(**redis_params)
    
    # load refl instrument if nothing specified in config
    instruments = getattr(config, 'instruments', ['refl']) 
    for instrument_id in instruments:
        getattr(dataflow.modules, instrument_id).define_instrument()
Пример #2
0
def create_instruments():

    fetch.DATA_SOURCES = config.data_sources

    if getattr(config, 'use_redis', False):
        redis_params = getattr(config, "redis_params", {})
        use_redis(**redis_params)
    elif getattr(config, 'use_diskcache', False):
        diskcache_params = getattr(config, "diskcache_params", {})
        use_diskcache(**diskcache_params)

    # load refl instrument if nothing specified in config
    instruments = getattr(config, 'instruments', ['refl'])
    for instrument_id in instruments:
        getattr(dataflow.modules, instrument_id).define_instrument()
Пример #3
0
def create_instruments():

    fetch.DATA_SOURCES = config.data_sources

    if getattr(config, 'use_redis', False):
        redis_params = getattr(config, "redis_params", {})
        use_redis(**redis_params)
    elif getattr(config, 'use_diskcache', False):
        diskcache_params = getattr(config, "diskcache_params", {})
        use_diskcache(**diskcache_params)
    
    if getattr(config, 'use_compression', False):
        cache = get_cache()
        cache._use_compression = True

    # load refl instrument if nothing specified in config
    instruments = getattr(config, 'instruments', ['refl'])
    for instrument_id in instruments:
        instrument_module = importlib.import_module('dataflow.modules.{instr}'.format(instr=instrument_id))
        instrument_module.define_instrument()
Пример #4
0

def demo():
    from dataflow.calc import process_template

    template = unpolarized_template()
    #print "========== Template ========"
    #template.show()
    #print "="*24
    test_dataset = [{
        'path': "ncnrdata/cgd/201511/21066/data/HMDSO_17nm_dry14.nxz.cgd",
        'mtime': 1447353278
    }]
    refl = process_template(
        template=template,
        config={"0": {
            "filelist": test_dataset
        }},
        target=(len(template.modules) - 1, "output"),
        #target=(2, "data"),  # return an input
    )
    #print "refl",refl.values
    return refl.values


if __name__ == "__main__":
    from dataflow.cache import use_redis
    use_redis()
    define_instrument()
    demo()
Пример #5
0
        diagram=diagram,
        instrument=refl1d,
        version=1.0,
        )
    return template

def demo():
    from dataflow.calc import process_template

    template = unpolarized_template()
    #print "========== Template ========"
    #template.show()
    #print "="*24
    test_dataset = [{'path': "ncnrdata/cgd/201511/21066/data/HMDSO_17nm_dry14.nxz.cgd",
                      'mtime': 1447353278}]
    refl = process_template(template=template,
                            config={"0": {"filelist": test_dataset}},
                            target=(len(template.modules)-1, "output"),
                            #target=(2, "data"),  # return an input
                            )
    #print "refl",refl.values
    return refl.values


if __name__ == "__main__":
    from dataflow.cache import use_redis
    use_redis()
    define_instrument()
    demo()