log = ezlog.setup() log.info('defining assign') def assign(v, boundary=0.3): if v <= boundary: s = 0 else: s = 1 return s log.info('Setting up vars') mydirname = os.path.dirname(sys.argv[0]) inroot = os.path.join(mydirname, 'relaxation-data') nprocs = 2 ezlog.set_level(ezlog.INFO) rax.setup_pool(nprocs) log.info('Loading project') project = rax.load_project(inroot, outputfreq=0.5) find_states = functools.partial(assign, boundary=0.9) p2 = project.map(find_states) log.info('Print results') for t in p2.get_trajectories(): print t.run, t.clone, t.get_trajectory_data()
import rax import curry modules = Modules() modules.use('~/Public/modulefiles') modules.load('python/2.7.1', 'fax/devel') daxproj = dax.Project('test', 'lcls','fah', 10009) locations = dax.read_filelist('tests/p10009.xtclist.test2.chirp', kind='chirp', host='lclsstor01.crc.nd.edu', port=9987) locations = dax.read_filelist('tests/p10009.xtclist.test2') daxproj.load_locations(_test_dax_read_path, locations) daxproj.write_dax() data = daxproj.locations('*.xtc', files=True) raxproj = rax.Project() mapper = Mapper(curry.curry(_test_MyFunc), modules) mapper.process(data, raxproj, chunksize=5) raxproj.write('/tmp/raxproj') if __name__ == '__main__': import rax ezlog.set_level(ezlog.DEBUG, __name__) ezlog.set_level(ezlog.INFO, dax.__name__) ezlog.set_level(ezlog.DEBUG, rax.__name__) _test()
import dax import ezlog import os import re import sys ezlog.set_level(ezlog.INFO, dax.__name__) mydir = os.path.dirname(sys.argv[0]) xtclist = os.path.join(mydir, 'lcls.10009') proj = dax.Project('tests', 'lcls', 'fah', 10009) proj.load_dax()
chirp_locations = read_filelist(filelist, kind='chirp', host='localhost', port=9887) def read_path(path): re_gen = re.compile(r'%(sep)sresults-([0-9]+)' % {'sep':os.sep}) r,c = read_cannonical_traj(path) m = re_gen.search(path) if not m: raise ValueError, 'Cannot parse generation from %s' % path g = int(m.group(1)) return r,c,g proj = Project('tests', 'lcls', 'fah', 10009) proj.load_locations(read_path, chirp_locations) proj.write_dax() def _test(): proj = Project('tests', 'lcls', 'fah', 10009) proj.load_dax() locs = proj.locations('*.xtc', files=False) for l in locs: print l if __name__ == '__main__': ezlog.set_level(ezlog.DEBUG, __name__) _test()