Exemple #1
0
        _save_one(f, ext)  # not bundles
    return {}


def _save_one(input, ext):
    outname = initname = map_files('save')
    if ext is not None:
        outname = ".".join([os.path.splitext(outname)[0], ext])
    print "saving", initname, 'as', outname
    with open(outname, 'w') as f:
        f.write(str(input.__str__()))


save = save_module(id='sans.save',
                   datatype=SANS_DATA,
                   version='1.0',
                   action=save_action,
                   xtype="SaveContainer")


# Modules
def correct_dead_time_action(sample_in,
                             empty_cell_in,
                             empty_in,
                             blocked_in,
                             deadtimeConstant=3.4e-6,
                             **kwargs):

    deadtimeConstant = float(deadtimeConstant)
    lis = [sample_in[0], empty_cell_in[0], empty_in[0], blocked_in[0]]
    print "List: ", lis
Exemple #2
0
load = load_module(id='sans.load', datatype=SANS_DATA,
                   version='1.0', action=load_action)


# Save module
def save_action(input=None, ext=None):
    for f in input: _save_one(f, ext) # not bundles
    return {}
def _save_one(input, ext):
    outname = initname = "/home/elakian/.txt"
    if ext is not None:
        outname = ".".join([os.path.splitext(outname)[0], ext])
    print "saving", initname, 'as', outname
    with open(outname, 'w') as f:
        f.write(str(input.__str__()))
save = save_module(id='sans.save', datatype=SANS_DATA,
                   version='1.0', action=save_action)


# Modules
def monitor_normalize_action(input=None):
    
    #flat = []
    ##np.set_printoptions(edgeitems = 128)
    #for bundle in input:
        #flat.extend(bundle)
    result = [monitor_normalize(f) for f in input]
    return dict(output=result)
mon_norm = monitor_normalize_module(id='sans.monitor_normalize', datatype=SANS_DATA, version='1.0', action=monitor_normalize_action)

def convertq_action(input=None):
    flat = []
Exemple #3
0
    return {}
def _save_one(input, ext):
    outname = input['name']
    if ext is not None:
        outname = ".".join([os.path.splitext(outname)[0], ext])
    print "saving", input['name'], 'as', outname
    save_data(input, name=outname)
# the 'ext'ension field; there's no use in saving fields though (hopefully there will be a need later?)
save_ext = {
    "type":"[string]",
    "label": "Save extension",
    "name": "ext",
    "value": "",
}
save = save_module(id='rowan.save', datatype=ROWAN_DATA,
                   version='1.0', action=save_action,
                   fields=[save_ext])

# ========== Fake data store =============
FILES = {}
def init_data():
    global FILES
    f1 = {'name': 'f1.rowan26',
          'x': [1, 2, 3, 4, 5., 6, 7, 8],
          'y': [20, 40, 60, 80, 60, 40, 20, 6],
          'monitor': [100] * 8,
          }
    f2 = {'name': 'f2.rowan26',
          'x': [4, 5, 6, 7, 8, 9],
          'y': [37, 31, 18, 11, 2, 1],
          'monitor': [50] * 6,
    
load = load_module(id='sans.load', datatype=SANS_DATA, version='1.0', action=load_action)


# Save module
def save_action(input=[], ext='', **kwargs):
    for f in input: _save_one(f, ext) # not bundles
    return {}
def _save_one(input, ext):
    outname = initname = map_files('save')
    if ext is not None:
        outname = ".".join([os.path.splitext(outname)[0], ext])
    print "saving", initname, 'as', outname
    with open(outname, 'w') as f:
        f.write(str(input.__str__()))
save = save_module(id='sans.save', datatype=SANS_DATA,
                   version='1.0', action=save_action, xtype="SaveContainer")


# Modules
def correct_dead_time_action(sample_in, empty_cell_in, empty_in, blocked_in, deadtimeConstant=3.4e-6 , **kwargs):
    
    deadtimeConstant = float(deadtimeConstant)
    lis = [sample_in[0], empty_cell_in[0], empty_in[0], blocked_in[0]] 
    print "List: ", lis
    #Enter DeadTime parameter eventually
    solidangle = [correct_solid_angle(f) for f in lis]
    det_eff = [correct_detector_efficiency(f) for f in solidangle]
    deadtime = [correct_dead_time(f, deadtimeConstant) for f in det_eff]
    result = deadtime
    return dict(sample_out=[result[0]], empty_cell_out=[result[1]], empty_out=[result[2]], blocked_out=[result[3]])
deadtime = correct_dead_time_module(id='sans.correct_dead_time', datatype=SANS_DATA, version='1.0', action=correct_dead_time_action, xtype=xtype)
Exemple #5
0
    if ext is not None:
        outname = ".".join([os.path.splitext(outname)[0], ext])
    print "saving", input['name'], 'as', outname
    save_data(input, name=outname)


# the 'ext'ension field; there's no use in saving fields though (hopefully there will be a need later?)
save_ext = {
    "type": "[string]",
    "label": "Save extension",
    "name": "ext",
    "value": "",
}
save = save_module(id='rowan.save',
                   datatype=ROWAN_DATA,
                   version='1.0',
                   action=save_action,
                   fields=[save_ext])

# ========== Fake data store =============
FILES = {}


def init_data():
    global FILES
    f1 = {
        'name': 'f1.rowan26',
        'x': [1, 2, 3, 4, 5., 6, 7, 8],
        'y': [20, 40, 60, 80, 60, 40, 20, 6],
        'monitor': [100] * 8,
    }