import pylab import voc_reader from pylab import * from sklearn import linear_model from scipy import stats from matplotlib.offsetbox import AnchoredText # The path to where the raw files are stored path = "../Data/wacl_data/Raw_data_files/" f_date = '201610' cal_file = os.listdir(path + f_date + '/MOS') # The name of the MOS file to be analysed Time_avg = '300S' data_concat = mr.readin(path, f_date, cal_file, 1, 5, Time_avg) data_voc = voc_reader.extract_voc('../Data/', 'Detailed Compound Concentrations', 'Analyte vs Time', Time_avg) data_merge = data_concat.merge(data_voc, how='inner', on=['Time']) sub = 'vocs6' voc6 = ['C3H3+ (1,3-butadiene;O2+) (ppb)', 'MOS1c_Av'] VOCs6fig = plt.figure("vocs6") ax1 = VOCs6fig.add_subplot(111) ax2 = ax1.twinx() colors = [ "black", "firebrick", "lightgreen", "c", "darkblue", "purple", "orange", "forestgreen", "lightskyblue", "indigo", "dimgrey", "fuchsia" ] ax = [] for n, c in zip(voc6, colors): if n == 'MOS1c_Av':
except NameError: data_concat = mean_resampled.copy(deep=True) print(' making data_concat') # Re-make and re-set the index to be the time column for the data_concat dataframe. T3 = pd.datetime(2015, 1, 1, 0) dt = pd.Series((data_concat.index - T3), index=data_concat.index, name='dt') dt = dt.astype(int64) data_concat = pd.concat([data_concat, dt], axis=1, join_axes=[data_concat.index]) stat = 'Y' header = [ 'MOS1_Av', 'MOS2_Av', 'MOS3_Av', 'MOS4_Av', 'MOS5_Av', 'MOS6_Av', 'MOS7_Av', 'MOS8_Av', 'HIH1_Av', 'LM65T1_Av', 'SV_Av' ] #data_concat.to_csv('test.csv', index = False, columns = header) data_concat.to_csv('test.csv', columns=header) newindex = pd.Series(range(0, data_concat.shape[0])) data_concat = data_concat.set_index(newindex) # Returns the initial date and time that the file began print(data_concat.Time[0]) print(data_concat.Time[len(data_concat.Time) - 1]) data_voc = voc_reader.extract_voc('D:/WACL/Data/', 'Detailed Compound Concentrations', 'Analyte vs Time') #print(data_concat.Time) data_merge = data_voc.merge(data_concat, how='inner', on=['Time']) data_merge.to_csv('test3.csv')
import voc_reader import MOS_reader as mr from pylab import * from sklearn import linear_model from scipy import stats # The path to where the raw files are stored path = "../Data/wacl_data/Raw_data_files/" f_date = '201610' cal_file = os.listdir(path + f_date + '/MOS') # The name of the MOS file to be analysed data_concat = mr.readin(path, f_date, cal_file, 1, 5) #correlation between MOSc and other signals data_voc = voc_reader.extract_voc('..\Data\\', 'Detailed Compound Concentrations', 'Analyte vs Time') data_merge = data_concat.merge(data_voc, how='inner', on=['Time']) print( np.corrcoef(data_merge['MOS1c_Av'], data_merge['CH5O+ (methanol;H3O+) (ppb)'])) print( np.corrcoef(data_merge['MOS1c_Av'], data_merge['CH3CN.H+ (acetonitrile;H3O+) (ppb)'])) print( np.corrcoef(data_merge['MOS1c_Av'], data_merge['C3H7O+ (acetone;H3O+) (ppb)'])) print( np.corrcoef(data_merge['MOS1c_Av'], data_merge['C4H6O.H+ (3-buten-2-one;H3O+) (ppb)'])) print(