def execute(): validate_args() classic_analyzer = None if len(sys.argv) == 1: league_name = input("Enter league name: ") league_id = read_input("Enter league ID: ") managers_count = read_input("Managers count to be analyzed: ") print() classic_analyzer = ClassicAnalyzer(ids_file="", league_name=league_name, league_id=league_id, managers_count=managers_count) if len(sys.argv) == 2: if not validate_input(sys.argv[1]): sys.exit(1) classic_analyzer = ClassicAnalyzer(sys.argv[1]) classic_analyzer.print_table() classic_analyzer.save_output_to_file() load_stats_menu(classic_analyzer)
def main(): parser = argparse.ArgumentParser(description='Conversion of input file to canonical SMILES with RDKit.') parser.add_argument('-i', '--input', metavar='input.sdf', required=True, help='input file with compounds. Supported formats: SMILES (*.smi), ' 'SDF (*.sdf, *.sdf.gz), Python pickled (*.pkl).') parser.add_argument('-o', '--output', metavar='output.smi', required=True, help='output file with canonical SMILES.') parser.add_argument('-c', '--ncpu', metavar='INTEGER', required=False, default=1, type=int, help='number of CPUs to use for computation.') parser.add_argument('-v', '--verbose', action='store_true', default=False, help='print progress to STDERR.') args = parser.parse_args() with open(args.output, 'wt') as f: if args.ncpu > 1: p = Pool(max(1, min(args.ncpu, cpu_count()))) iterator = p.imap(calc, read_input(args.input)) else: iterator = (calc(line) for line in read_input(args.input)) for i, res in enumerate(iterator, 1): if res[0]: f.write('\t'.join(res) + '\n') if args.verbose and i % 10000 == 0: sys.stderr.write(f'\r{i} molecules passed')
def main_params(in_fname, dupl_fname, out_fname, ref_fname, stereo, ref_only): saver = Chem.SDWriter(out_fname) d = dict() # key - inchi_key, value - list of names # read reference compounds if ref_fname is not None: for i, (mol, mol_name) in enumerate(read_input(ref_fname)): if mol is not None: inchi_key = get_inchi_key(mol, stereo) if inchi_key not in d.keys(): d[inchi_key] = [mol_name] for i, (mol, mol_name)in enumerate(read_input(in_fname)): if mol is not None: inchi_key = get_inchi_key(mol, stereo) if inchi_key not in d.keys(): saver.write(mol) if not ref_only: d[inchi_key] = [mol_name] else: d[inchi_key].append(mol_name) if dupl_fname is not None: with open(dupl_fname, 'wt') as f: for values in d.values(): for v in values[1:]: f.write(values[0] + '\t' + v + '\n')
def main(): parser = argparse.ArgumentParser(description='Select compounds matching the specified substructure.') parser.add_argument('-i', '--in', metavar='FILENAME', required=True, help='input SMILES/SDF file. SMILES file should contain no header.') parser.add_argument('-o', '--out', metavar='FILENAME', required=True, help='output file with SMILES and compound names.') parser.add_argument('-s', '--substr', metavar='SMARTS_STRING', required=True, nargs='+', help='SMARTS string used for substructure matching. If multiple patterns were ' 'supplied at least one of them should be matched or, if negate argument ' 'used, all of them should not matched.') parser.add_argument('-f', '--field_name', metavar='SDF_FIELD_NAME', default=None, help='if sdf was passed as input the field name with molecule title can be optionally ' 'specified.') parser.add_argument('-c', '--ncpu', metavar='INTEGER', required=False, default=1, help='Number of CPU cores to use. Default: 1.') parser.add_argument('-n', '--negate', action='store_true', default=False, help='return SMILES which DO NOT match the pattern.') parser.add_argument('-v', '--verbose', action='store_true', default=False, help='print progress to STDERR.') args = vars(parser.parse_args()) for o, v in args.items(): if o == "in": in_fname = v if o == "out": out_fname = v if o == "substr": pattern = v if o == "field_name": field_name = v if o == "ncpu": ncpu = int(v) if o == "verbose": verbose = v if o == "negate": neg = v patt = [Chem.MolFromSmarts(p) for p in pattern] if ncpu == 1: with open(out_fname, 'wt') as f: match_counter = 0 for i, (mol, mol_title) in enumerate(read_input(in_fname, id_field_name=field_name)): res = match((mol, mol_title)) if res[0]: f.write('%s\t%s\n' % res[1:]) f.flush() match_counter += 1 if verbose and (i + 1) % 100 == 0: sys.stderr.write('\r%i molecules passed; matches: %i' % (i + 1, match_counter)) sys.stderr.flush() else: pool = Pool(max(1, min(ncpu, cpu_count()))) with open(out_fname, 'wt') as f: match_counter = 0 for i, res in enumerate(pool.imap(match, read_input(in_fname, id_field_name=field_name)), 1): if res[0]: f.write('%s\t%s\n' % res[1:]) f.flush() match_counter += 1 if verbose and i % 100 == 0: sys.stderr.write('\r%i molecules passed; matches: %i' % (i, match_counter)) sys.stderr.flush()
def init_transfers_analyzer_many_managers(): league_name = input("Enter league name: ") league_id = read_input("Enter league ID: ") managers_count = read_input("Managers count to be analyzed: ") print() return TransfersAnalyzerManyManagers(ids_file="", league_name=league_name, league_id=league_id, managers_count=managers_count)
def main(): live_points = read_input(get_data(day=17)) after_6_steps = update_n_steps(live_points, 6) print(f"After 6 steps, there are {len(after_6_steps)} cubes active.") live_points = read_input(get_data(day=17), dim=4) after_6_steps = update_n_steps(live_points, 6) print( f"After 6 steps in four dimensions, there are {len(after_6_steps)} cubes active." )
def calc(input_fname, output_fname): w = Chem.SDWriter(output_fname) for mol, mol_name in read_input(input_fname): mol.SetProp('_Name', mol_name) for conf in mol.GetConformers(): w.write(mol, conf.GetId()) w.close()
def execute(): team_id = read_input("Enter team ID: ") print() autosubs_analyzer = AutosubsAnalyzer(team_id) autosubs_analyzer.print_table() autosubs_analyzer.save_output_to_file()
def main(fname): with open(fname, 'r') as fh: warehouses, orders, type_weighs, maximum_load, num_drones, deadline = read_input(fh) drones = [ Drone( kk, warehouses[0].pos, type_weighs, maximum_load ) for kk in range(num_drones) ] orders = sort_orders(warehouses[0], orders, type_weighs, maximum_load) n_drones = len(drones) for j in range(len(orders)//n_drones): for i in range(n_drones): print(i) procces_order(orders[i+n_drones*j], drones[i], warehouses) n_cmds = sum([len(x.commands) for x in drones]) output_file = fname.replace("input","outputs") with open(output_file, "w") as file_out: file_out.write("{0}\n".format(n_cmds)) for drone in drones: drone.gencommands(file_out) print("*****DONE******")
def calc(in_fname, out_fname, rms, noH, ncpu, verbose): p = Pool(ncpu, initializer=pool_init, initargs=[rms, noH]) with open(out_fname, 'wb') as fout: for i, res in enumerate(p.imap_unordered(filter_conf, read_input(in_fname), chunksize=20), 1): pickle.dump(res, fout, -1) if verbose and (i + 1) % 1000 == 0: sys.stderr.write('\rCompounds processed: %i' % (i + 1)) sys.stderr.write('\n')
def main(): """ Main program to process input file and generate required answers """ input_content = read_input.read_input("input.txt") currency = change_to_roman_numerals.change_to_roman_numerals(input_content) unit_price = price.calculate_unit_price(input_content, currency) answers.get_answers(input_content, currency, unit_price)
def main(input_fname, output_fname, ncpu, verbose): pool = Pool(max(min(cpu_count(), ncpu), 1)) with open(output_fname, 'wt') as f: for j, output_str in enumerate( pool.imap(process_mol_map, read_input(input_fname)), 1): if output_str: f.write(output_str) if verbose and j % 1000 == 0: sys.stderr.write(f'\r{j} molecules passed')
def app(): input = read_input("day3.data") transposed = transpose(input) ints = [list(map(int, list_of_strings)) for list_of_strings in transposed] most_common = [most_common_bit(int_list) for int_list in ints] least_common = [least_common_bit(int_list) for int_list in ints] gamma = binary_list_to_int(most_common) epsilon = binary_list_to_int(least_common) part1 = gamma * epsilon print(part1)
def main(): parser = argparse.ArgumentParser( description='Calculate RDKit descriptors.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-i', '--input', metavar='FILENAME', required=True, help='SMILES or SDFfile.') parser.add_argument('-o', '--output', metavar='FILENAME', required=True, help='text file with a computed descriptor matrix.') parser.add_argument( '-d', '--descr', metavar='STRING', default='AP', required=False, help='type of descriptors: AP (atom pairs). Default: AP.') parser.add_argument('-c', '--ncpu', metavar='INTEGER', required=False, default=1, type=int, help='number of cores for calculation. Default: 1.') parser.add_argument('-v', '--verbose', action='store_true', default=False, help='print progress to STDERR.') args = parser.parse_args() funcs = {'AP': calc_ap} pool = Pool(args.ncpu) mol_names = [] fps = [] for i, (mol_name, fp) in enumerate( pool.imap(funcs[args.descr], read_input(args.input), chunksize=100), 1): mol_names.append(mol_name) fps.append(fp) if i % 1000 == 0: sys.stdout.write(f'\r{i} molecules were processed') d = pd.DataFrame(fps).fillna(0).astype(int) d.index = mol_names d.index.name = 'mol' d.to_csv(args.output, sep='\t')
def calc(in_fname, out_fname, error_fname, input_format, output_format): if out_fname is None: out_fname = '/dev/stdout' if error_fname is None: error_fname = '/dev/stderr' if output_format == 'sdf': wout = Chem.SDWriter(out_fname) else: print("Error output format.") exit() werr = Chem.SmilesWriter(error_fname, delimiter='\t', isomericSmiles=True) werr.SetProps(['Sanitization_error']) for mol, mol_name in read_input(in_fname, input_format=input_format, sanitize=False): if mol is not None: err = Chem.SanitizeMol(mol, catchErrors=True) if err: sys.stderr.write('Error %i sanitizing molecule %s\n' % (err, mol_name)) sys.stderr.flush() mol.SetProp('Sanitization_error', str(err)) werr.write(mol) else: try: Chem.Kekulize(mol) double = len(get_unspec_double_bonds(mol)) if double: mol.SetProp("Double bonds", str(double)) tetra = sum(i[1] == '?' for i in Chem.FindMolChiralCenters( mol, includeUnassigned=True)) if tetra: mol.SetProp("Undefined stereocenters", str(tetra)) chg = Chem.GetFormalCharge(mol) if chg: mol.SetProp("Charge", str(chg)) wout.write(mol) except: mol.SetProp('Sanitization_error', 'Kekulization failed') werr.write(mol) werr.close() wout.close()
def run_solution(): for file_name in input_files: genotypes = convert_input(read_input(file_name)) (greedy_haplotypes, greedy_solution) = greedy_solver(genotypes) (opt_haplotypes_count, opt_solution, total_branches, branches_explored, case_1_prunes, case_2_prunes) = \ branch_and_bound(genotypes, len(greedy_haplotypes), greedy_solution) print 'solution for \'{}\':'.format(file_name) for line in opt_solution: print line print ''
def main(): # read from the puzzle input filename = sys.argv[1] file_contents = read_input.read_input(filename) # build the matrix for the graph bag_matrix = build_matrix.build_matrix(file_contents, "shiny gold") # use the giant matrix to solve for parts 1 and 2 part1_sol, part2_sol = solve.solve_parts1_and_2(bag_matrix) print(f"Part 1 solution: {part1_sol}") print(f"Part 2 solution: {part2_sol}")
def __init__(self, myfile): self.myfile = myfile self.ds = read_input(myfile) (self.X, self.deltaX, self.rotation, self.Y, self.rotation, self.deltaY) = self.ds.GetGeoTransform() self.arys = [] for i in xrange(1, self.ds.RasterCount + 1): self.arys.append(self.ds.GetRasterBand(i).ReadAsArray()) try: self.ary = self.ds.GetRasterBand(1).ReadAsArray() except RuntimeError, e: print "Band (%i) not found" %band_num print e sys.exit(1)
def main(): problem = read_input(vocal=False) # print('Problem', problem) solver = Solver(problem) dep = solver.dependency_relation print('Dependency graph', dep) traces = solver.get_trace() print('Traces', traces) foata = solver.get_foata() print('Foata', foata) foata = solver.get_foata_from_graph() print('Foata', foata) solver.dependency_graph.plot()
def main(): lst = read_input(input_file) init = lst[0] try: my_connection = psycopg2.connect(host='localhost', user=init['open']['login'], password=init['open']['password'], dbname='projekt') except: print("status: ERROR") return create_database(my_connection) sz = len(lst) for i in range(1, sz): man_json(lst[i], my_connection)
def main_params(in_fname, out_fname, ncpu, verbose): pool = Pool(ncpu) with open(out_fname, 'wt') as fo: for i, (mol, mol_name) in enumerate( pool.imap(get_largest_mp, read_input(in_fname, sanitize=True)), 1): if mol: fo.write( f'{Chem.MolToSmiles(mol, isomericSmiles=True)}\t{mol_name}\n' ) if verbose and i % 1000 == 0: sys.stderr.write(f'\r{i} records were processed') if verbose: sys.stderr.write('\n')
def execute(): validate_args() team_id = read_input("Enter team ID: ") print() if len(sys.argv) == 1: hth_analyzer = HthAnalyzerLeagues(team_id) else: if not validate_input(sys.argv[1]): sys.exit(1) hth_analyzer = HthAnalyzerFromFile(team_id=team_id, ids_file=sys.argv[1]) hth_analyzer.print_all_matchups() hth_analyzer.save_output_to_file()
def app(): input = read_input("day2.data") horizontal = 0 depth = 0 aim = 0 for cmd in input: amount = get_amount(cmd) if cmd.startswith("forward"): depth += (aim * amount) horizontal += amount if cmd.startswith("up"): aim -= amount # depth -= amount if cmd.startswith("down"): aim += amount # depth += amount part2 = horizontal * depth print(part2)
def generate_samples(n=200, samples_dir='~/datasets/vrnn/samples/', channels=4, half_size=True): input_dir = os.path.join(samples_dir, 'short') sample_gt_dir = os.path.join(samples_dir, 'long') if not os.path.isdir(input_dir): os.makedirs(input_dir) os.makedirs(os.path.join(input_dir, '100')) os.makedirs(os.path.join(input_dir, '250')) os.makedirs(os.path.join(input_dir, '300')) if not os.path.isdir(sample_gt_dir): os.makedirs(sample_gt_dir) os.makedirs(os.path.join(sample_gt_dir, '100')) os.makedirs(os.path.join(sample_gt_dir, '250')) os.makedirs(os.path.join(sample_gt_dir, '300')) for i in range(n): print("Generating sample nr {}".format(i)) sample_fp = np.random.choice(test_fps) id = os.path.basename(sample_fp)[0:5] gt_files = glob.glob(gt_dir + '{}_00*.ARW'.format(id)) gt_fp = gt_files[0] sample_exp = float(os.path.basename(sample_fp)[9:-5]) gt_exp = float(os.path.basename(gt_fp)[9:-5]) ratio = min(gt_exp / sample_exp, 300) sample_photo = read_input(sample_fp, ratio, channels) gt_photo = read_gt(gt_fp, half_size) sample_photo, gt_photo = augment_photos(sample_photo, gt_photo) sample_photo = sample_photo[0, :, :, :] gt_photo = gt_photo[0, :, :, :] curr_input_dir = os.path.join(input_dir, str(int(ratio))) curr_gt_dir = os.path.join(sample_gt_dir, str(int(ratio))) output_sample_path = os.path.join( curr_input_dir, os.path.basename(sample_fp))[:-4] + '_{}.png'.format(i) output_gt_path = os.path.join( curr_gt_dir, os.path.basename(gt_fp))[:-4] + '_{}.png'.format(i) imageio.imsave(output_sample_path, img_as_ubyte(sample_photo)) imageio.imsave(output_gt_path, img_as_ubyte(gt_photo))
def main_params(in_fname, good_fname, bad_fname): if good_fname is not None: wgood = Chem.SDWriter(good_fname) if bad_fname is not None: wbad = Chem.SDWriter(bad_fname) for mol, mol_name in read_input(in_fname, input_format='sdf', sanitize=False): if mol is not None: errors = False n = len(Chem.GetMolFrags(mol)) # chg = Chem.GetFormalCharge(mol) elm = set(a.GetSymbol() for a in mol.GetAtoms()) elm_diff = elm - good_elm if 'C' not in elm: # no carbon mol.SetProp('Eval:no carbons', '1') errors = True if elm_diff: # any illegible atom mol.SetProp('Eval:illegible atoms', ', '.join(sorted(list(elm_diff)))) errors = True if n > 1: # multi-component if len(set(Chem.MolToSmiles(frag, isomericSmiles=True) for frag in Chem.GetMolFrags(mol, asMols=True))) > 1: # number of unique components mol.SetProp('Eval:multi-component', str(n)) errors = True else: # if all components are identical keep one component as a mol with all fields tmp_mol = Chem.GetMolFrags(mol, asMols=True)[0] for prop_name in mol.GetPropNames(includePrivate=True): tmp_mol.SetProp(prop_name, mol.GetProp(prop_name)) mol = tmp_mol if errors: if bad_fname is not None: wbad.write(mol) else: wgood.write(mol)
def calc(fname, outpath, ncpu, field, pH, preserve_coord, save_sdf, no_protonation, seed, out_format): if outpath and not os.path.exists(outpath): os.mkdir(outpath) if no_protonation: mol_gener = read_input.read_input(fname, input_format=None, id_field_name=field, sanitize=True) else: sdf_pHprotonate = subprocess.check_output(cmd_run.format( fname=fname, out_format='sdf', pH=pH), shell=True) if save_sdf is not None: with open(save_sdf, 'w') as out_sdf: out_sdf.write(sdf_pHprotonate.decode()) mol_gener = zip( Chem.ForwardSDMolSupplier(BytesIO(sdf_pHprotonate), sanitize=True), iter_molname(fname, field)) if ncpu > 1: p = Pool(max(1, min(ncpu, cpu_count()))) p.map( partial(convert2pdb, outpath=outpath, preserve_coord=preserve_coord, seed=seed, out_format=out_format), mol_gener) else: list( map( partial(convert2pdb, outpath=outpath, preserve_coord=preserve_coord, seed=seed, out_format=out_format), mol_gener))
def create_db(db_fname, input_fname, protonation, pdbqt_fname, protein_setup_fname, prefix): conn = sqlite3.connect(db_fname) cur = conn.cursor() cur.execute("""CREATE TABLE IF NOT EXISTS mols ( id TEXT PRIMARY KEY, smi TEXT, smi_protonated TEXT, docking_score REAL, pdb_block TEXT, mol_block TEXT, time TEXT )""") conn.commit() data = [(f'{prefix}-{mol_name}' if prefix else mol_name, Chem.MolToSmiles(mol, isomericSmiles=True)) for mol, mol_name in read_input(input_fname)] cur.executemany(f'INSERT INTO mols (id, smi) VALUES(?, ?)', data) conn.commit() cur.execute("""CREATE TABLE IF NOT EXISTS setup ( protonation INTEGER, protonation_done INTEGER DEFAULT 0, protein_pdbqt TEXT, protein_setup TEXT )""") conn.commit() pdbqt_string = open(pdbqt_fname).read() setup_string = open(protein_setup_fname).read() cur.execute('INSERT INTO setup VALUES (?,?,?,?)', (int(protonation), 0, pdbqt_string, setup_string)) conn.commit() conn.close()
import scipy.optimize import george from george import kernels import batman import corner import mcmc import lc_class from read_input import read_input import TransitModel import deliverables # Read in MPI flag from user input file --------------------------------------- try: input_file = read_input('test_suite_input_file.txt') except IOError: print "Input file is not in the same directory as driver program."+\ " Move to same directory or change path." raise input_param_dic = input_file.param_dic #remove following for loop once we correct read_input.py for key in input_param_dic.keys(): if len(input_param_dic[key]) == 1: input_param_dic[key] = input_param_dic[key][0] mpi_flag = input_param_dic['mpi_flag'] if mpi_flag: try: from mpi4py import MPI
import shutil from get_UBC_mesh import get_UBC_mesh from read_input import read_input from read_UBC_log import read_UBC_log from numpy import * from numpy.linalg import * from comp_dmdx import comp_dmdx from comp_dmdy import comp_dmdy from comp_dmdz import comp_dmdz from make_depthW import make_depthW from get_input_files import get_input_files from get_Ws3D import get_Ws3D Home_dir, UBC_dir, iter_start, chifact, pvec, qvec, lvec, cool_beta, iter_max, layers = read_input( 'lp_IP_input.inp') Home_dir = Home_dir + '\\' UBC_dir = UBC_dir + '\\' Work_dir = Home_dir + 'Workspace\\' if not os.path.exists(Work_dir): os.makedirs(Work_dir) else: shutil.rmtree(Work_dir) os.makedirs(Work_dir) if iter_start > 10: strnum = str(iter_start) else: strnum = '0' + str(iter_start)
# EM_inv_run.py # Author: D Fournier # Last Update: July 16th, 2013 # # This program runs a series of EM inversions on a unix cluster, as specified # a list of lines. import os import shutil from read_input import read_input from numpy import * Home_dir, UBC_dir, iter_start, chifact, pvec, qvec, lvec, cool_beta, iter_max = read_input( 'Python_input.inp') Work_dir = Home_dir + 'Workspace\\' if not os.path.exists(Work_dir): os.makedirs(Work_dir) else: shutil.rmtree(Work_dir) os.makedirs(Work_dir) if iter_start > 10: strnum = str(iter_start) else: strnum = '0' + str(iter_start) for ll in range(size(lvec)): for pp in range(size(pvec)):
for seq_type in DNA, RNA: complement_table[seq_type] = string.maketrans( original_bases[seq_type], complement_bases[seq_type]) return complement_table # When called/imported, always set up the complement table complement_table = complement_table_setup() ### The actual complement function def complement(input_sequence, input=''): # if input type isn't given, detect RNA/DNA sequence type (default to DNA) if input == 'DNA': input_type = DNA elif input == 'RNA': input_type = RNA else: if input_sequence.count('U') > 0: input_type = RNA elif input_sequence.count('u') > 0: input_type = RNA else: input_type = DNA complement_seq = input_sequence.translate(complement_table[input_type]) return complement_seq ### If called directly, read, parse and complement the input. if __name__ == '__main__': import read_input, transform_sequence_input, parse_fasta input = read_input.read_input() for line in transform_sequence_input.transform_sequence_input( input, complement): parse_fasta.print_seq(line)
#! /usr/bin/env python """ This program takes one DNA sequence as an argument, prints the reverse-complement. Weronika Patena, nov2008 """ import complement ### The actual reverse-complement function: def reverse_complement(input_sequence,input_type=''): # use the complement function from the complement module complement_seq = complement.complement(input_sequence,input_type) # easy reverse method: full list slice with a step of -1 reverse_complement_seq = complement_seq[::-1] return reverse_complement_seq ### If called directly: # try reading the argument; if none given, read from stdin (which is what makes it work with pipes (echo ctcgag | script.py) and when called on a selection in vi and such). if __name__ == '__main__': import read_input,transform_sequence_input,parse_fasta # check if input is a list of files (i.e. if first arg is a valid filename - good enough) input = read_input.read_input() # transform_sequence_input takes an input AND the function to apply to it - in this case rev-compl for line in transform_sequence_input.transform_sequence_input(input,reverse_complement): parse_fasta.print_seq(line)
def prep_input(fname, id_field_name, nconf, energy, rms, seed): input_format = 'smi' if fname is None else None for mol, mol_name, act, mol_id in read_input(fname, input_format=input_format, id_field_name=id_field_name): yield mol, mol_name, nconf, energy, rms, seed, act, mol_id
def read(cls): """create by reading in standard form""" definition=read_input('zero','.potential',force=True,doc='potential definition string') return Potential(definition)
#! /usr/bin/env python # demonstration of the FFT split step method import sys from read_input import read_input_open,read_input import axis from qmoperator import * import physical_system as phys # get the input list from input file read_input_open(sys.argv[1]) tmin=read_input(0.,'.time grid',1,doc='start time for time-propagation') tmax=read_input(1.,'.time grid',2,doc='end time for time-propagation') tinc=read_input(0.1,'.time grid',3,doc='time-increment') # set up the axis ax=Axis.read() kinetic=Operator('kinetic',ax) potential=Operator('+1 |q^2|',ax) hamiltonian=kinetic+potential wf0=WaveFunction.create(ax,'gauss',[1.,1.]) # time-propagate and plot wf0.t=tmin t=np.arange(tmin+tinc,tmax+tinc,tinc) wft=hamiltonian.evolve(wf0,t)