pysilcam/oilgas.py
def convert_to_pj_format(stats_csv_file, config_file):
    '''converts stats files into a total, and gas-only time-series csvfile which can be read by the old matlab
    SummaryPlot exe'''

    settings = PySilcamSettings(config_file)
    logger.info('Loading stats....')
    stats = pd.read_csv(stats_csv_file)

    base_name = stats_csv_file.replace('-STATS.csv', '-PJ.csv')
    gas_name = base_name.replace('-PJ.csv', '-PJ-GAS.csv')

    ogdatafile = DataLogger(base_name, ogdataheader())
    ogdatafile_gas = DataLogger(gas_name, ogdataheader())

    stats['timestamp'] = pd.to_datetime(stats['timestamp'])
    u = stats['timestamp'].unique()
    sample_volume = sc_pp.get_sample_volume(settings.PostProcess.pix_size, path_length=settings.PostProcess.path_length)

    logger.info('Analysing time-series')
    for s in tqdm(u):
        substats = stats[stats['timestamp'] == s]
        nims = sc_pp.count_images_in_stats(substats)
        sv = sample_volume * nims

        oil = extract_oil(substats)
        dias, vd_oil = sc_pp.vd_from_stats(oil, settings.PostProcess)
        vd_oil /= sv

        gas = extract_gas(substats)
        dias, vd_gas = sc_pp.vd_from_stats(gas, settings.PostProcess)
        vd_gas /= sv
        d50_gas = sc_pp.d50_from_vd(vd_gas, dias)

        vd_total = vd_oil + vd_gas
        d50_total = sc_pp.d50_from_vd(vd_total, dias)

        data_total = cat_data_pj(s, vd_total, d50_total, len(oil) + len(gas))
        ogdatafile.append_data(data_total)

        data_gas = cat_data_pj(s, vd_gas, d50_gas, len(gas))
        ogdatafile_gas.append_data(data_gas)

    logger.info('  OK.')

    logger.info('Deleting header!')
    with open(base_name, 'r') as fin:
        data = fin.read().splitlines(True)
    with open(base_name, 'w') as fout:
        fout.writelines(data[1:])
    with open(gas_name, 'r') as fin:
        data = fin.read().splitlines(True)
    with open(gas_name, 'w') as fout:
        fout.writelines(data[1:])
    logger.info('Conversion complete.')
converts stats files into a total, and gas-only time-series csvfile which can be read by the old matlab
    SummaryPlot exe
converts stats files into a total, and gas-only time-series csvfile which can be read by the old matlab
SummaryPlot exe
converts stats files into a total and gas - only time - series csvfile which can be read by the old matlab SummaryPlot exe
def convert_to_pj_format(stats_csv_file, config_file):
    settings = PySilcamSettings(config_file)
    logger.info('Loading stats....')
    stats = pd.read_csv(stats_csv_file)
    base_name = stats_csv_file.replace('-STATS.csv', '-PJ.csv')
    gas_name = base_name.replace('-PJ.csv', '-PJ-GAS.csv')
    ogdatafile = DataLogger(base_name, ogdataheader())
    ogdatafile_gas = DataLogger(gas_name, ogdataheader())
    stats['timestamp'] = pd.to_datetime(stats['timestamp'])
    u = stats['timestamp'].unique()
    sample_volume = sc_pp.get_sample_volume(settings.PostProcess.pix_size, path_length=settings.PostProcess.path_length)
    logger.info('Analysing time-series')
    for s in tqdm(u):
        substats = stats[stats['timestamp'] == s]
        nims = sc_pp.count_images_in_stats(substats)
        sv = sample_volume * nims
        oil = extract_oil(substats)
        dias, vd_oil = sc_pp.vd_from_stats(oil, settings.PostProcess)
        vd_oil /= sv
        gas = extract_gas(substats)
        dias, vd_gas = sc_pp.vd_from_stats(gas, settings.PostProcess)
        vd_gas /= sv
        d50_gas = sc_pp.d50_from_vd(vd_gas, dias)
        vd_total = vd_oil + vd_gas
        d50_total = sc_pp.d50_from_vd(vd_total, dias)
        data_total = cat_data_pj(s, vd_total, d50_total, len(oil) + len(gas))
        ogdatafile.append_data(data_total)
        data_gas = cat_data_pj(s, vd_gas, d50_gas, len(gas))
        ogdatafile_gas.append_data(data_gas)
    logger.info('  OK.')
    logger.info('Deleting header!')
    with open(base_name, 'r') as fin:
        data = fin.read().splitlines(True)
    with open(base_name, 'w') as fout:
        fout.writelines(data[1:])
    with open(gas_name, 'r') as fin:
        data = fin.read().splitlines(True)
    with open(gas_name, 'w') as fout:
        fout.writelines(data[1:])
    logger.info('Conversion complete.')
def convert_to_pj_format ( stats_csv_file , config_file ) : settings = PySilcamSettings ( config_file ) logger . info ( 'Loading stats....' ) stats = pd . read_csv ( stats_csv_file ) base_name = stats_csv_file . replace ( '-STATS.csv' , '-PJ.csv' ) gas_name = base_name . replace ( '-PJ.csv' , '-PJ-GAS.csv' ) ogdatafile = DataLogger ( base_name , ogdataheader ( ) ) ogdatafile_gas = DataLogger ( gas_name , ogdataheader ( ) ) stats [ 'timestamp' ] = pd . to_datetime ( stats [ 'timestamp' ] ) u = stats [ 'timestamp' ] . unique ( ) sample_volume = sc_pp . get_sample_volume ( settings . PostProcess . pix_size , path_length = settings . PostProcess . path_length ) logger . info ( 'Analysing time-series' ) for s in tqdm ( u ) : substats = stats [ stats [ 'timestamp' ] == s ] nims = sc_pp . count_images_in_stats ( substats ) sv = sample_volume * nims oil = extract_oil ( substats ) dias , vd_oil = sc_pp . vd_from_stats ( oil , settings . PostProcess ) vd_oil /= sv gas = extract_gas ( substats ) dias , vd_gas = sc_pp . vd_from_stats ( gas , settings . PostProcess ) vd_gas /= sv d50_gas = sc_pp . d50_from_vd ( vd_gas , dias ) vd_total = vd_oil + vd_gas d50_total = sc_pp . d50_from_vd ( vd_total , dias ) data_total = cat_data_pj ( s , vd_total , d50_total , len ( oil ) + len ( gas ) ) ogdatafile . append_data ( data_total ) data_gas = cat_data_pj ( s , vd_gas , d50_gas , len ( gas ) ) ogdatafile_gas . append_data ( data_gas ) logger . info ( '  OK.' ) logger . info ( 'Deleting header!' ) with open ( base_name , 'r' ) as fin : data = fin . read ( ) . splitlines ( True ) with open ( base_name , 'w' ) as fout : fout . writelines ( data [ 1 : ] ) with open ( gas_name , 'r' ) as fin : data = fin . read ( ) . splitlines ( True ) with open ( gas_name , 'w' ) as fout : fout . writelines ( data [ 1 : ] ) logger . info ( 'Conversion complete.' )
converts stats files into a total, and gas-only time-series csvfile which can be read by the old matlab
SummaryPlot exe
converts stats files into a total and gas - only time - series csvfile which can be read by the old matlab SummaryPlot exe
'''converts stats files into a total, and gas-only time-series csvfile which can be read by the old matlab
    SummaryPlot exe'''
stats_csv_file
config_file