Commit 68ab94e7 authored by Francesco Amadori's avatar Francesco Amadori
Browse files

Plot adjusted

parent 6746454b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ def get_target_info(path_targets_folder, target):
            yaml_file["v_system_km_s"],
            yaml_file.get("Limit_Phase_T14", yaml_file.get("Limit_Phase", 0)),
            yaml_file["kp_km_s"],
            yaml_file["ks_km_s"],
            yaml_file["ecc"],
            yaml_file["periastron_argument"],
            yaml_file["stellar_teff_K"],
@@ -105,7 +106,7 @@ def get_target_info(path_targets_folder, target):
            yaml_file.get("t23_hours", 0),
        )
    else:
        return [None for _ in range(27)]
        return [None for _ in range(28)]


def get_target_nights(path_targets, target, rad_mode, instrument="GIANO_B", simulated=0):
+14 −11
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ class Frame_Gofio:
                nights = ""
            (
                self.target_name, self.target_radius, self.target_mass, self.target_gravity, self.target_t_eq, self.target_stellar_radius, self.target_stellar_mass,
                self.target_p0, self.target_hjd0, self.target_period, self.target_vsys, self.target_limph, self.target_kp, self.target_ecc, self.target_opi,
                self.target_p0, self.target_hjd0, self.target_period, self.target_vsys, self.target_limph, self.target_kp, self.target_ks, self.target_ecc, self.target_opi,
                self.target_stellar_teff, self.target_ra, self.target_dec, self.target_a_Rs_ratio, self.target_projected_obliquity, self.target_inclination,
                self.target_v_sini, self.target_limph_T12, self.target_limph_T23, self.target_t14_hours, self.target_t12_hours, self.target_t23_hours
            ) = DataInterface.get_target_info(
@@ -1173,7 +1173,7 @@ class Frame_Gofio:
        (
            self.target_name, self.target_radius, self.target_mass, self.target_gravity, self.target_t_eq,
            self.target_stellar_radius, self.target_stellar_mass,
            self.target_p0, self.target_hjd0, self.target_period, self.target_vsys, self.target_limph, self.target_kp,
            self.target_p0, self.target_hjd0, self.target_period, self.target_vsys, self.target_limph, self.target_kp, self.target_ks,
            self.target_ecc, self.target_opi,
            self.target_stellar_teff, self.target_ra, self.target_dec, self.target_a_Rs_ratio,
            self.target_projected_obliquity, self.target_inclination,
@@ -1536,13 +1536,14 @@ class Frame_Gofio:
        pickle.dump(corr_zero, file)
        file.close()

        fig = plt.figure()
        plt.plot(np.array(mjd) - np.min(mjd), rms)
        plt.xlabel("MJD [days]")
        plt.ylabel("RMS [m/s]")
        plt.title(night_f)
        filepng = str(Path(dirn_f, prefix + "RMS_MJD.png"))
        plt.savefig(fname=filepng, bbox_inches='tight', pad_inches=0.1)
        plt.close()
        plt.close(fig)

        if not self.chosen_separation_var.get():
            self.image_RMS = ImageTk.PhotoImage(
@@ -1582,13 +1583,14 @@ class Frame_Gofio:
                Image.open(filepng).resize((self.width_from_gofio, self.height_from_gofio)))
            self.panel_RMS.create_image(0, 0, anchor=tk.NW, image=self.image_RMS)

        fig = plt.figure()
        plt.plot(np.array(mjd) - np.min(mjd), snr)
        plt.xlabel("MJD [days]")
        plt.ylabel("SNR")
        plt.title(night_f)
        filepng = str(Path(dirn_f, prefix + "SNR_MJD.png"))
        plt.savefig(fname=filepng, bbox_inches='tight', pad_inches=0.1)
        plt.close()
        plt.close(fig)
        if prefix == "B_":
            self.image_SNR_B = ImageTk.PhotoImage(
                Image.open(filepng).resize((self.width_from_gofio, self.height_from_gofio)))
@@ -1598,13 +1600,14 @@ class Frame_Gofio:
                Image.open(filepng).resize((self.width_from_gofio, self.height_from_gofio)))
            self.panel_SNR.create_image(0, 0, anchor=tk.NW, image=self.image_SNR)

        fig = plt.figure()
        plt.plot(np.array(mjd) - np.min(mjd), um)
        plt.xlabel("MJD [days]")
        plt.ylabel("Humidity")
        plt.title(night_f)
        filepng = str(Path(dirn_f, prefix + "Humidity_MJD.png"))
        plt.savefig(fname=filepng, bbox_inches='tight', pad_inches=0.1)
        plt.close()
        plt.close(fig)
        if prefix == "B_":
            self.image_hum_B = ImageTk.PhotoImage(
                Image.open(filepng).resize((self.width_from_gofio, self.height_from_gofio)))
@@ -1617,8 +1620,6 @@ class Frame_Gofio:
            self.panel_hum.create_image(0, 0, anchor=tk.NW, image=self.image_hum)
            self.orders_A.insert(tk.END, orders_str)
            self.SNR_Area_A.insert(tk.END, SNR_mean_str)
        plt.clf()
        plt.close()
        #
        # Create a colormap and normalize based on the parameter range
        # Initialize the plot
@@ -1639,7 +1640,8 @@ class Frame_Gofio:
        sm = cm.ScalarMappable(cmap=cmap, norm=norm)
        sm.set_array(am)  # Explicitly set the array of parameter values
        fig.colorbar(sm, ax=ax, label="Airmass")
        plt.savefig(filepng)  # Associate colorbar with the plot
        fig.savefig(filepng)
        plt.close(fig)
        if prefix == "B_":
            self.image_flux_airmass_B = ImageTk.PhotoImage(
                Image.open(filepng).resize((self.width_from_gofio, self.height_from_gofio)))
@@ -1770,7 +1772,7 @@ class Frame_Gofio:

    def wcal_auto(self):
        target = self.chosen_target_var.get()
        _, _, _, _, _, _, _, _, _, _, vsys, _, _, _, _, stellar_teff, _, _, _, _, _, _, _, _, _, _, _ = DataInterface.get_target_info(
        _, _, _, _, _, _, _, _, _, _, vsys, _, _, _, _, _, stellar_teff, _, _, _, _, _, _, _, _, _, _, _ = DataInterface.get_target_info(
            self.path_target, target
        )
        instrument = self.chosen_instrument_var_post.get()
@@ -1857,7 +1859,7 @@ class Frame_Gofio:

    def test_wlen_calib(self):
        target = self.chosen_target_var.get()
        _, _, _, _, _, _, _, _, _, _, vsys, _, _, _, _, stellar_teff, _, _, _, _, _, _, _, _, _, _, _ = DataInterface.get_target_info(
        _, _, _, _, _, _, _, _, _, _, vsys, _, _, _, _, _, stellar_teff, _, _, _, _, _, _, _, _, _, _, _ = DataInterface.get_target_info(
            self.path_target, target
        )
        instrument = self.chosen_instrument_var_post.get()
@@ -2083,11 +2085,12 @@ class Frame_Gofio:
        (
            target_name, target_radius, target_mass, target_gravity, target_t_eq, target_stellar_radius,
            target_stellar_mass, target_p0, target_hjd0,
            target_period, target_vsys, target_limph, target_kp, target_ecc, target_opi, target_stellar_teff, target_ra,
            target_period, target_vsys, target_limph, target_kp, target_ks, target_ecc, target_opi, target_stellar_teff, target_ra,
            target_dec,
            target_a_Rs_ratio, target_projected_obliquity, target_inclination,
            target_v_sini, target_limph_T12, target_limph_T23, target_t14_hours, target_t12_hours, target_t23_hours
         ) = DataInterface.get_target_info(self.path_target, target_id)
        self.current_target_
        self.radius_DB_up.delete(0, tk.END)
        self.radius_DB_up.insert(tk.END, target_radius)
        self.mass_DB_up.delete(0, tk.END)