コード例 #1
0
ファイル: proper_save.py プロジェクト: NPopiel/MPhil
test_lst = []

lines_per_file = [18, 18, 16, 16, 19, 19, 19]
rows_after_header_useless = [True, True, True, True, True, True, True]
#rows_before_header_useless = [False, False, False, False, True, True, True]

for ind, name in enumerate(filenames):

    filename = main_path + name

    parameters = [
        delimeter, rows_after_header_useless[ind], delete_comment_flag,
        new_headers, convert_b_flag, cols_to_remove
    ]

    file = DataFile(filename, parameters)

    df = file.open()

    if ind == 0:
        inds = np.where(np.array(df['temp']) > 2.75)[0]
        df.drop(inds + 1, inplace=True)
        df = df.reset_index()
    if ind == 2:
        inds = np.where(np.array(df['temp']) > 3.75)[0]
        df.drop(inds + 1, inplace=True)
        df = df.reset_index()
    if ind == 5:
        inds = np.where(np.array(df['temp']) > 6.75)[0]
        df.drop(inds + 1, inplace=True)
        df = df.reset_index()
コード例 #2
0
ファイル: plt_w_eaton_stuff.py プロジェクト: NPopiel/MPhil
          117,
          127,
          129]

for ind, folder in enumerate(folders):

    filename_field = main_path + folder + m_v_h_names[ind]

    parameters = [delimeter,
                  row_after_header_useless,
                  delete_comment_flag,
                  new_headers,
                  convert_b_flag,
                  cols_to_keep]

    file_field = DataFile(filename_field, parameters)
    field_df = file_field.open()
    field_df = field_df[['Temperature (K)', 'Magnetic Field (Oe)','DC Moment Fixed Ctr (emu)', 'DC Moment Free Ctr (emu)']]
    #arr = scipy.ndimage.filters.median_filter(np.array(field_df['DC Moment Fixed Ctr (emu)']), size=3)
    #interpd_arr = np.interp(np.array(field_df['Magnetic Field (Oe)']), np.array(field_df['Magnetic Field (Oe)']), arr)
    #smoothed_arr = moving_average(arr,5)
    #field_df['DC Moment Fixed Ctr (emu)'] = arr
    #field_df['DC Moment Fixed Ctr (emu)'] = field_df['DC Moment Fixed Ctr (emu)'].rolling(3).mean()
    field_df['Placement'] = labels[ind]
    field_lst.append(field_df)


big_field_df = pd.concat(field_lst)


コード例 #3
0
ファイル: load_dat.py プロジェクト: NPopiel/MPhil
for ind, folder in enumerate(folders):

    angle_num = ind+1

    filename_field = main_path + folder + m_v_h_names[ind]
    filename_temps = main_path + folder + m_v_t_names[ind]

    parameters = [delimeter,
                  row_after_header_useless,
                  delete_comment_flag,
                  new_headers,
                  convert_b_flag,
                  cols_to_keep]

    file_field = DataFile(filename_field, parameters)
    field_df = file_field.open()
    field_df = field_df[['Temperature (K)', 'Magnetic Field (Oe)','DC Moment Fixed Ctr (emu)', 'DC Moment Free Ctr (emu)']]
    field_df['Angle'] = 'Angle '+ str(angle_num)
    field_lst.append(field_df)

    file_temps = DataFile(filename_temps, parameters)
    temps_df = file_temps.open()
    temps_df = temps_df[['Temperature (K)', 'Magnetic Field (Oe)', 'DC Moment Fixed Ctr (emu)', 'DC Moment Free Ctr (emu)']]
    temps_df['Angle'] = 'Angle '+ str(angle_num)
    temp_lst.append(temps_df)


big_field_df = pd.concat(field_lst)
big_temp_df = pd.concat(temp_lst)