def process_tweet_paraphrase(input_path, output_path): raw_tweet_dataset = read_csv(input_path, load_header=True, delimiter="\t") tweet_dataset = [[ idx, clean_tweet_text(row[2]), clean_tweet_text(row[3]), raw_label_map(row[4]) ] for idx, row in enumerate(raw_tweet_dataset)] header = ["index", "sent1", "sent2", "label"] write_csv(tweet_dataset, header, output_path, delimiter="\t")
sheet.write(19, 0, 'Species') sheet.write(19, 1, 'Diameter (cm)') sheet.write(19, 2, 'Trees/ha') sheet.write(19, 3, 'Height (m)') sheet.write(19, 4, 'Total Age') sheet.write(19, 5, 'BHAge') ############################################################################### book = Workbook() for plotfile in glob('*.csv'): plot, _ = plotfile.split('.') meas = read_csv(plotfile) sheet = book.add_sheet(plot) mgm_sheet(sheet, plot, 0, 0) for i, r in enumerate(meas): sheet.write(20+i, 0, r.species) # species sheet.write(20+i, 1, float(r.dbh)/10.0) # diameter sheet.write(20+i, 2, 10.0) # trees/ha sheet.write(20+i, 3, 10.0) # height sheet.write(20+i, 4, 10.0) # total age sheet.write(20+i, 5, 10.0) # bhage book.save('MGM Stands.xls')
def __init__(self): Kernel.__init__(self) self.time_dependent = True # read climate data and measurements (cm^2) climate = read_csv('kernels/artr/climate.csv') measurements = read_csv('kernels/artr/survivalDataARTR.csv') years = sorted(list(set([ int(x.year) for x in measurements ]))) fecundity_measurements = read_csv('kernels/artr/fecdat.csv') log_areas = {} for year in years: log_areas[year] = [ float(x.logArea) for x in measurements if int(x.year) == year ] # set attributes self.n0 = log_areas[years[0]] self.log_areas = log_areas self.years = years self.climate = climate self.fec_meas = fecundity_measurements self.mortality_type = 'noexp' self.fecundity_type = 'uniform_exp' self._tweak_covariat = None self._tweak_factor = 1.0 # set parameters self.params = { 'growth': { 'mean': np.array( [ -6.134753578, 0.765515413, 0.006574618, 0.362328659 ]), 'covariance': np.array( [[ 2.3003264050, -3.551420e-04, -9.540608e-04, -1.202835e-01 ], [ -0.0003551420, 3.699543e-04, 1.274024e-06, -6.374569e-05 ], [ -0.0009540608, 1.274024e-06, 3.545569e-06, 3.898729e-05 ], [ -0.1202834507, -6.374569e-05, 3.898729e-05, 6.350332e-03 ]]) }, 'survival': { 'mean': np.array( [ -1.482555395, 0.753372235, 0.003454076, -0.001100492 ]), 'covariance': np.array( [[ 1.149244e-01, -1.422819e-02, -4.075111e-04, 5.042504e-05 ], [ -1.422819e-02, 1.058307e-02, 5.006554e-05, -3.693585e-05 ], [ -4.075111e-04, 5.006554e-05, 1.520893e-06, -1.896803e-07 ], [ 5.042504e-05, -3.693585e-05, -1.896803e-07, 1.351324e-07 ]]) }, 'fecundity': { 'mean': np.array( [ 3.16420466, 0.06773083, 0.02146190 ]), 'covariance': np.array( [[ 2.900329e-02, 3.790527e-04, 2.113102e-05 ], [ 3.790527e-04, 1.101385e-04, 8.486999e-06 ], [ 2.113102e-05, 8.486999e-06, 1.079253e-05 ]]) } } # default parameters self.growth_params = self.params['growth']['mean'] self.survival_params = self.params['survival']['mean'] self.fecundity_params = self.params['fecundity']['mean']