def make_charts(): chdir() # Display options for numpy and pandas set_display_options() update_all_labels_with_cal_range(ug_chart_items, mass_calibration_ranges, ["50", "1700"]) update_all_labels_with_cal_range(mg_chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename ug_target_samples = sort_n_filter_by_filename(all_samples, ug_chart_items) ug_identified_compounds = ug_target_samples.get_compounds() # Filter samples, reorder and rename mg_target_samples = sort_n_filter_by_filename(all_samples, mg_chart_items) mg_identified_compounds = mg_target_samples.get_compounds() all_identified_compounds = sorted({*ug_identified_compounds, *mg_identified_compounds}) # Remove nitrobenzene all_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(ug_target_samples, ["Nitrobenzene"]) warn_if_all_filtered(mg_target_samples, ["Nitrobenzene"]) fig, ax = create_figure(tex_page, left=0.155, top=0.09) fig, ax = plot_areas(fig, ax, ug_target_samples, all_identified_compounds, include_none=True, show_scores=True, legend_cols=3) fig.suptitle("Peak Areas and Scores for Alliant Unique Propellant", fontsize=14, y=0.985) # fig.set_size_inches(A4_portrait) # fig.tight_layout() # fig.subplots_adjust(bottom=0.13, top=0.91) savefig(fig, "charts/propellant_5ul_injection_micro.png", dpi=300) savefig(fig, "charts/propellant_5ul_injection_micro.svg") fig, ax = create_figure(tex_page, left=0.155, top=0.09) fig, ax = plot_areas(fig, ax, mg_target_samples, all_identified_compounds, include_none=True, show_scores=True, legend_cols=3) fig.suptitle("Peak Areas and Scores for Alliant Unique Propellant", fontsize=14, y=0.985) # fig.set_size_inches(A4_portrait) # fig.tight_layout() # fig.subplots_adjust(bottom=0.13, top=0.91) savefig(fig, "charts/propellant_5ul_injection_milli.png", dpi=300) savefig(fig, "charts/propellant_5ul_injection_milli.svg") # plt.show() fig, ax = create_figure(tex_page, left=0.15, bottom=0.17) fig, ax = plot_retention_times(fig, ax, ug_target_samples, ug_target_samples.get_compounds(), legend_cols=3) ax.set_ylabel("Concentration and Conditions") fig, ax = create_figure(tex_page, left=0.15, bottom=0.17) fig, ax = plot_retention_times(fig, ax, mg_target_samples, mg_target_samples.get_compounds(), legend_cols=3) ax.set_ylabel("Concentration and Conditions") plt.show()
def make_charts(): chdir() # Display options for numpy and pandas set_display_options() update_all_labels_with_cal_range(chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename target_samples = sort_n_filter_by_filename(all_samples, chart_items) all_identified_compounds: List[str] = target_samples.get_compounds() # Remove nitrobenzene all_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(target_samples, ["Nitrobenzene"]) # fig, ax = create_figure(tex_page_landscape, left=0.165, bottom=0.17) # without units fig, ax = create_figure(tex_page_landscape, left=0.135, bottom=0.17, top=0.09) fig, ax = plot_areas(fig, ax, target_samples, all_identified_compounds, show_scores=True, legend_cols=4, mz_range=(50, 1700)) # , include_none=True) # fig.suptitle("Peak Areas and Scores for Alliant Unique Propellant", fontsize=14, y=0.985) ax.set_ylabel("Concentration and Conditions") savefig(fig, "charts/benito_method_perms_propellant.png", dpi=600) savefig(fig, "charts/benito_method_perms_propellant.svg") # plt.show() fig, ax = create_figure(tex_page, left=0.215, bottom=0.13, top=0.02) fig, ax = plot_retention_times(fig, ax, target_samples, target_samples.get_compounds(), legend_cols=3) ax.set_ylabel("Concentration and Conditions") rt_data = make_rt_dataframe(target_samples.get_compounds(), target_samples) for compound, data in rt_data.iteritems(): print(compound) stdev = numpy.nanstd(data) mean = numpy.nanmean(data) print(mean) rsd = stdev / mean print(f"{rsd:.3%}") print() savefig(fig, "charts/benito_method_perms_propellant_rt.png", dpi=600) savefig(fig, "charts/benito_method_perms_propellant_rt.svg")
def make_charts(): chdir() # Display options for numpy and pandas set_display_options() update_all_labels_with_cal_range(chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename target_samples = sort_n_filter_by_filename(all_samples, chart_items) all_identified_compounds = target_samples.get_compounds() # Remove nitrobenzene # all_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(target_samples, ["Nitrobenzene"]) fig, ax = create_figure(tex_page_landscape, left=0.12) fig, ax = plot_areas(fig, ax, target_samples, all_identified_compounds, include_none=True, show_scores=True) fig.suptitle("Peak Areas and Scores for Alliant Unique Propellant", fontsize=14, y=0.985) # fig.subplots_adjust(bottom=0.11, top=0.90) savefig(fig, "charts/first_4_propellant_pos_and_neg.png", dpi=300) savefig(fig, "charts/first_4_propellant_pos_and_neg.svg") # plt.show() # worklist = load_json_worklist("data/worklist.json") # print(worklist) # # print(worklist.loc["Methanol Blank"]) # print(worklist.loc[worklist["Sample Name"] == "Methanol Blank"]) # print(worklist.loc[worklist["Sample Name"].str.startswith("Methanol")]) fig, ax = create_figure(tex_page, left=0.15, bottom=0.17) fig, ax = plot_retention_times(fig, ax, target_samples, target_samples.get_compounds(), legend_cols=3) fig.suptitle("Retention Times for Alliant Unique Propellant", fontsize=14, y=0.985) ax.set_ylabel("Concentration and Conditions") plt.show()
def make_charts(): chdir() # Display options for numpy and pandas set_display_options() # update_all_labels_with_cal_range(chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename target_samples = sort_n_filter_by_filename(all_samples, chart_items) all_identified_compounds = target_samples.get_compounds() # Remove nitrobenzene all_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(target_samples, ["Nitrobenzene"]) # fig, ax = create_figure(tex_page_landscape, left=0.2) # With m/z Range indicated fig, ax = create_figure(tex_page_landscape, left=0.125, top=0.09) # Without m/z Range indicated fig, ax = plot_areas( fig, ax, target_samples, all_identified_compounds, show_scores=True, mz_range=(100, 3200)) # , include_none=True, legend_cols=3) # fig.suptitle("Peak Areas and Scores for Mixed Standard", fontsize=14, y=0.985) ax.set_ylabel("Concentration and Conditions") savefig(fig, "charts/mixed_standards.png", dpi=600) savefig(fig, "charts/mixed_standards.svg") # plt.show() fig, ax = create_figure(tex_page, left=0.15, bottom=0.17) fig, ax = plot_retention_times(fig, ax, target_samples, target_samples.get_compounds(), legend_cols=3) ax.set_ylabel("Concentration and Conditions")
def make_charts(): chdir() # Display options for numpy and pandas set_display_options() # for item in chart_items: # print(mass_calibration_ranges[item.filename]) # print(item.new_name) update_all_labels_with_cal_range(chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename target_samples = sort_n_filter_by_filename(all_samples, chart_items) all_identified_compounds = target_samples.get_compounds() # Remove nitrobenzene all_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(target_samples, ["Nitrobenzene"]) fig, ax = create_figure(tex_page_landscape, left=0.23) fig, ax = plot_areas(fig, ax, target_samples, all_identified_compounds, include_none=True, show_scores=True) fig.suptitle( "Peak Areas and Scores for Standards with Reduced Flow Rate", fontsize=14, y=0.985, ) # Put actual number ax.set_ylabel("Concentration and Conditions") # fig.subplots_adjust(bottom=0.11, top=0.90) # fig.set_size_inches(to_inch(A4_landscape)) # fig.tight_layout() # fig.subplots_adjust(bottom=0.11, top=0.90) savefig(fig, "charts/standards_low_flow.png", dpi=300) savefig(fig, "charts/standards_low_flow.svg")
def make_charts(): chdir() # Display options for numpy and pandas set_display_options() update_all_labels_with_cal_range(ec_dpa_chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename ec_dpa_target_samples = sort_n_filter_by_filename(all_samples, ec_dpa_chart_items) ec_dpa_identified_compounds = ec_dpa_target_samples.get_compounds() # Remove nitrobenzene ec_dpa_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(ec_dpa_target_samples, ["Nitrobenzene"]) fig, ax = create_figure(tex_page_landscape, left=0.15, bottom=0.17, top=0.1) fig, ax = plot_areas( fig, ax, ec_dpa_target_samples, ec_dpa_identified_compounds, include_none=True, show_scores=True, legend_cols=4, show_score_in_legend=True, ) # fig.suptitle("Peak Areas and Scores with Method 3", fontsize=14, y=0.985) ax.set_ylabel("Concentration and Conditions") fig.text(0.739, 0.026, "¹²³", fontsize=9, zorder=20) fig.text(0.762, 0.026, "Repeat analyses", fontsize=9, zorder=20) savefig(fig, "charts/new_method_standards.png", dpi=600) savefig(fig, "charts/new_method_standards.svg") # update_all_labels_with_cal_range(std_mix_chart_items, mass_calibration_ranges, ["50", "1700"]) # Filter samples, reorder and rename std_mix_target_samples = sort_n_filter_by_filename(all_samples, std_mix_chart_items) std_mix_identified_compounds = std_mix_target_samples.get_compounds() # Remove nitrobenzene std_mix_identified_compounds.remove("Nitrobenzene") warn_if_all_filtered(std_mix_target_samples, ["Nitrobenzene"]) # fig, ax = create_figure(tex_page_landscape, left=0.2, bottom=0.2) # With mz range fig, ax = create_figure(tex_page_landscape, left=0.11, bottom=0.2, top=0.1) # Without mz range fig, ax = plot_areas( fig, ax, std_mix_target_samples, std_mix_identified_compounds, include_none=True, show_scores=True, legend_cols=4, # mz_range=(100, 3200) show_score_in_legend=True, ) # fig.suptitle("Peak Areas and Scores for Mixed Standard with Method 3", fontsize=14, y=0.985) ax.set_ylabel("Concentration") # and Conditions fig.text(0.637, 0.026, "Calibration Range: $100-3200~m/z$", fontsize=9, zorder=20) savefig(fig, "charts/new_method_mixed_standard.png", dpi=600) savefig(fig, "charts/new_method_mixed_standard.svg")