From 38964071fbef399fa8fb320547f2b759532da3fc Mon Sep 17 00:00:00 2001 From: fboschetty <64596942+fboschetty@users.noreply.github.com> Date: Sun, 21 Jan 2024 11:10:30 +0000 Subject: [PATCH 1/2] Update noise_averaging.py Changed Line 343 to correctly use identified phase type. --- src/Thermobar/noise_averaging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Thermobar/noise_averaging.py b/src/Thermobar/noise_averaging.py index e97c2bd..55e85c5 100644 --- a/src/Thermobar/noise_averaging.py +++ b/src/Thermobar/noise_averaging.py @@ -340,7 +340,7 @@ def add_noise_sample_1phase(phase_comp, phase_err=None, w.warn('Non unique sample names. We have appended the index onto all sample names to save issues with averaging later') TEST=Sample_c.index.values for i in range(0, len(Sample_c)): - Sample_c.loc[i, 'Sample_ID_Liq']=Sample_c['Sample_ID_Liq'].iloc[i]+'_'+str(TEST[i]) + Sample_c.loc[i, 'Sample_ID_{}'.format(elx)]=Sample_c['Sample_ID_{}'.format(elx)].iloc[i] + '_'+str(TEST[i]) if phase_err is None or (phase_err is not None and err_dist == "uniform"): From 2b7a88b9106f798736bd76c71e7de0bea676dbc2 Mon Sep 17 00:00:00 2001 From: fboschetty <64596942+fboschetty@users.noreply.github.com> Date: Sun, 21 Jan 2024 11:11:51 +0000 Subject: [PATCH 2/2] Update noise_averaging.py Changed Phase ID bit to make it more readable and easier to update for additional phases. --- src/Thermobar/noise_averaging.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Thermobar/noise_averaging.py b/src/Thermobar/noise_averaging.py index 55e85c5..924940f 100644 --- a/src/Thermobar/noise_averaging.py +++ b/src/Thermobar/noise_averaging.py @@ -314,22 +314,10 @@ def add_noise_sample_1phase(phase_comp, phase_err=None, 'specified a percent noise. Select only 1 of these options') # This works out what phase you have entered data for - if any(Sample_c.columns.str.contains("_Cpx")): - elx = 'Cpx' - if any(Sample_c.columns.str.contains("_Plag")): - elx = 'Plag' - if any(Sample_c.columns.str.contains("_Opx")): - elx = 'Opx' - if any(Sample_c.columns.str.contains("_Sp")): - elx = 'Sp' - if any(Sample_c.columns.str.contains("_Kspar")): - elx = 'Kspar' - if any(Sample_c.columns.str.contains("_Amp")): - elx = 'Amp' - if any(Sample_c.columns.str.contains("_Liq")): - elx = 'Liq' - if any(Sample_c.columns.str.contains("_Ol")): - elx = 'Ol' + Phase_Options = ["Cpx", "Plag", "Opx", "Sp", "Kspar", "Amp", "Liq", "Ol"] + for Option in Phase_Options: + if any(Sample_c.columns.str.contains(f"_{Option}")): + elx = Option if any(Sample_c.columns.str.contains('Sample_ID_{}'.format(elx))): name=True