示例#1
0
        instrument=SANS_INS.id,
    )
    #f = open("/home/elakian/tem.txt","w")
    #f.write("Template: ")
    #f.write( simplejson.dumps(wireit.template_to_wireit_diagram(template)))
    #f.write("\n")
    #f.write("Lang: ")
    #f.write(simplejson.dumps(wireit.instrument_to_wireit_language(SANS_INS)))
    #f.close()
    print 'TEMPLATE', simplejson.dumps(
        wireit.template_to_wireit_diagram(template))
    #print 'RAW_INSTRUMENT: ', wireit.instrument_to_wireit_language(SANS_INS)
    print 'LANGUAGE', simplejson.dumps(
        wireit.instrument_to_wireit_language(SANS_INS))

    run_template(template, config)
    #get_plottable(template,config,14,'OneD')
    #result = get_plottable(template, config, 14, 'OneD')

    #datadir=os.path.join(os.path.dirname(__file__),'ncnr_sample_data')
    #filedict={'empty_1m':os.path.join(datadir,'SILIC001.SA3_SRK_S101'),
    #'empty_4m':os.path.join(datadir,'SILIC002.SA3_SRK_S102'),
    #'empty_cell_1m':os.path.join(datadir,'SILIC003.SA3_SRK_S103'),
    #'blocked_1m':os.path.join(datadir,'SILIC004.SA3_SRK_S104'),
    #'trans_empty_cell_4m':os.path.join(datadir,'SILIC005.SA3_SRK_S105'),
    #'trans_sample_4m':os.path.join(datadir,'SILIC006.SA3_SRK_S106'),
    #'blocked_4m':os.path.join(datadir,'SILIC007.SA3_SRK_S107'),
    #'empty_cell_4m':os.path.join(datadir,'SILIC008.SA3_SRK_S108'),
    #'sample_1m':os.path.join(datadir,'SILIC009.SA3_SRK_S109'),
    #'sample_4m':os.path.join(datadir,'SILIC010.SA3_SRK_S110'),
    #'mask':os.path.join(datadir,'DEFAULT.MASK'),
                        modules=modules,
                        wires=wires,
                        instrument=SANS_INS.id,
                        )
    #f = open("/home/elakian/tem.txt","w")
    #f.write("Template: ")
    #f.write( simplejson.dumps(wireit.template_to_wireit_diagram(template)))
    #f.write("\n")
    #f.write("Lang: ")
    #f.write(simplejson.dumps(wireit.instrument_to_wireit_language(SANS_INS))) 
    #f.close()
    print 'TEMPLATE', simplejson.dumps(wireit.template_to_wireit_diagram(template))
    #print 'RAW_INSTRUMENT: ', wireit.instrument_to_wireit_language(SANS_INS)
    print 'LANGUAGE', simplejson.dumps(wireit.instrument_to_wireit_language(SANS_INS))                

    run_template(template, config)
    #get_plottable(template,config,14,'OneD')
    #result = get_plottable(template, config, 14, 'OneD')
    
    #datadir=os.path.join(os.path.dirname(__file__),'ncnr_sample_data')
    #filedict={'empty_1m':os.path.join(datadir,'SILIC001.SA3_SRK_S101'),
              #'empty_4m':os.path.join(datadir,'SILIC002.SA3_SRK_S102'),
              #'empty_cell_1m':os.path.join(datadir,'SILIC003.SA3_SRK_S103'),
              #'blocked_1m':os.path.join(datadir,'SILIC004.SA3_SRK_S104'),
              #'trans_empty_cell_4m':os.path.join(datadir,'SILIC005.SA3_SRK_S105'),
              #'trans_sample_4m':os.path.join(datadir,'SILIC006.SA3_SRK_S106'),
              #'blocked_4m':os.path.join(datadir,'SILIC007.SA3_SRK_S107'),
              #'empty_cell_4m':os.path.join(datadir,'SILIC008.SA3_SRK_S108'),
              #'sample_1m':os.path.join(datadir,'SILIC009.SA3_SRK_S109'),
              #'sample_4m':os.path.join(datadir,'SILIC010.SA3_SRK_S110'),
              #'mask':os.path.join(datadir,'DEFAULT.MASK'),
示例#3
0
                 datatypes=[data2d],
                 )
instruments = [SANS_INS]

# Testing
if __name__ == '__main__':
    for instrument in instruments:
        register_instrument(instrument)
    modules = [
        dict(module="sans.load", position=(5, 20),
             config={'files': ["/home/elakian/dataflow/reduction/sans/ncnr_sample_data/PLEX_2NOV2007_NG3.DIV","/home/elakian/dataflow/reduction/sans/ncnr_sample_data/SILIC002.SA3_SRK_S102","/home/elakian/dataflow/reduction/sans/ncnr_sample_data/SILIC005.SA3_SRK_S105","/home/elakian/dataflow/reduction/sans/ncnr_sample_data/SILIC006.SA3_SRK_S106","/home/elakian/dataflow/reduction/sans/ncnr_sample_data/SILIC010.SA3_SRK_S110"], 'intent': 'signal'}),
        dict(module="sans.save", position=(280, 40), config={'ext': 'dat'}),
        dict(module="sans.monitor_normalize", position=(360 , 60), config={}),
        dict(module="sans.correct_detector_efficiency", position=(360 , 60), config={}),
        dict(module="sans.correct_background", position=(360 , 60), config={}),
        ]
    wires = [
        dict(source=[0, 'output'], target=[2, 'input']),
        dict(source=[2, 'output'], target=[1, 'input']),
        
        ]
    config = [d['config'] for d in modules]
    template = Template(name='test sans',
                        description='example sans diagram',
                        modules=modules,
                        wires=wires,
                        instrument=SANS_INS.id,
                        )
    result = run_template(template, config)
    pprint(result)
    
示例#4
0
    dict(source=[1, 'output'], target=[2, 'input']),
]
# I'm unsure why config is needed currently if nothing needs to be supplied
# However, it does need to be the same length as the modules list
config = [
    {},
    {},
    {},
]
template = Template(
    name='test rowan',
    description='example ROWAN diagram',
    modules=modules,
    wires=wires,
    instrument=ROWAN26.id,
)
# the actual call to perform the reduction
result = run_template(template, config)
pprint(result)

# (testing, andy)
# ========= Convert the instrument definition to WireIt language =========
#from dataflow.wireit import instrument_to_wireit_language as wlang
#from dataflow.wireit import template_to_wireit_diagram as wdiag

#print "LANGUAGE:"
#print wlang(ROWAN26)
#print
#print "DIAGRAM:"
#print wdiag(template)