random_data_generator.py
def merge_temp_and_flux_files(temp_file, flux_file):
    """
    Puts together two CSV files with temperature data and with flux data
    """

    temp_time_values = []
    temp_temp_values = []
    with open(temp_file, "r") as csv_file:
        csv_reader = reader(csv_file)
        next(csv_reader, None)
        for row in csv_reader:
            if row and row[0]:
                temp_time_values.append(float(row[0]))
                temp_temp_values.append(float(row[1]))

    flux_time_values = []
    flux_flux_values = []
    flux_ambient_values = []
    with open(flux_file, "r") as csv_file:
        csv_reader = reader(csv_file)
        next(csv_reader, None)
        for row in csv_reader:
            # Disalowing zero time here, as it is not present in temperature file
            if row and float(row[0]):
                flux_time_values.append(float(row[0]))
                flux_flux_values.append(float(row[1]))
                flux_ambient_values.append(float(row[2]))

    # Interpolating temperature data in all the times from flux document
    new_temp = np.interp(flux_time_values, temp_time_values, temp_temp_values)

    new_filename = "aggregated-{}.csv".format(int(time.time()))
    with open(new_filename, "w") as csv_file:
        csv_writer = writer(csv_file)
        headers = ["Time", "HeatFlux", "Temperature", "T_amb"]
        csv_writer.writerow(headers)

        combined = zip(flux_time_values, flux_flux_values, new_temp, flux_ambient_values)

        for row in combined:
            csv_writer.writerow(row)

    Puts together two CSV files with temperature data and with flux data
    
Puts together two CSV files with temperature data and with flux data
Puts together two CSV files with temperature data and with flux data
def merge_temp_and_flux_files(temp_file, flux_file):
    temp_time_values = []
    temp_temp_values = []
    with open(temp_file, "r") as csv_file:
        csv_reader = reader(csv_file)
        next(csv_reader, None)
        for row in csv_reader:
            if row and row[0]:
                temp_time_values.append(float(row[0]))
                temp_temp_values.append(float(row[1]))
    flux_time_values = []
    flux_flux_values = []
    flux_ambient_values = []
    with open(flux_file, "r") as csv_file:
        csv_reader = reader(csv_file)
        next(csv_reader, None)
        for row in csv_reader:
            if row and float(row[0]):
                flux_time_values.append(float(row[0]))
                flux_flux_values.append(float(row[1]))
                flux_ambient_values.append(float(row[2]))
    new_temp = np.interp(flux_time_values, temp_time_values, temp_temp_values)
    new_filename = "aggregated-{}.csv".format(int(time.time()))
    with open(new_filename, "w") as csv_file:
        csv_writer = writer(csv_file)
        headers = ["Time", "HeatFlux", "Temperature", "T_amb"]
        csv_writer.writerow(headers)
        combined = zip(flux_time_values, flux_flux_values, new_temp, flux_ambient_values)
        for row in combined:
            csv_writer.writerow(row)
def merge_temp_and_flux_files ( temp_file , flux_file ) : temp_time_values = [ ] temp_temp_values = [ ] with open ( temp_file , "r" ) as csv_file : csv_reader = reader ( csv_file ) next ( csv_reader , None ) for row in csv_reader : if row and row [ 0 ] : temp_time_values . append ( float ( row [ 0 ] ) ) temp_temp_values . append ( float ( row [ 1 ] ) ) flux_time_values = [ ] flux_flux_values = [ ] flux_ambient_values = [ ] with open ( flux_file , "r" ) as csv_file : csv_reader = reader ( csv_file ) next ( csv_reader , None ) for row in csv_reader : if row and float ( row [ 0 ] ) : flux_time_values . append ( float ( row [ 0 ] ) ) flux_flux_values . append ( float ( row [ 1 ] ) ) flux_ambient_values . append ( float ( row [ 2 ] ) ) new_temp = np . interp ( flux_time_values , temp_time_values , temp_temp_values ) new_filename = "aggregated-{}.csv" . format ( int ( time . time ( ) ) ) with open ( new_filename , "w" ) as csv_file : csv_writer = writer ( csv_file ) headers = [ "Time" , "HeatFlux" , "Temperature" , "T_amb" ] csv_writer . writerow ( headers ) combined = zip ( flux_time_values , flux_flux_values , new_temp , flux_ambient_values ) for row in combined : csv_writer . writerow ( row )
Puts together two CSV files with temperature data and with flux data
Puts together two CSV files with temperature data and with flux data
"""
    Puts together two CSV files with temperature data and with flux data
    """ # Disalowing zero time here, as it is not present in temperature file # Interpolating temperature data in all the times from flux document
temp_file
flux_file