|  | 
| 39 | 39 | flagged_pixels = 0 | 
| 40 | 40 | 
 | 
| 41 | 41 | for pixel_id in np.arange(N_PIXELS): | 
| 42 |  | -    print("Working on pixel {}".format(pixel_id)) | 
|  | 42 | +    print(f"Working on pixel {pixel_id}") | 
| 43 | 43 |     # fill panda dataframe | 
| 44 | 44 |     temperatures = [] | 
| 45 | 45 |     channels = [] | 
|  | 
| 49 | 49 |     for dataset in data: | 
| 50 | 50 |         for run_number in dataset["runs"]: | 
| 51 | 51 |             run_number = int(run_number) | 
| 52 |  | -            filename = os.environ[ | 
| 53 |  | -                "NECTARCAMDATA" | 
| 54 |  | -            ] + "/runs/pedestal_cfilt3s_{}.h5".format(run_number) | 
|  | 52 | +            filename = ( | 
|  | 53 | +                os.environ["NECTARCAMDATA"] + f"/runs/pedestal_cfilt3s_{run_number}.h5" | 
|  | 54 | +            ) | 
| 55 | 55 |             h5file = tables.open_file(filename) | 
| 56 | 56 |             table = h5file.root["data_combined"]["NectarCAMPedestalContainer_0"][0] | 
| 57 | 57 |             for channel in ["hg", "lg"]: | 
| 58 |  | -                pedestal = table["pedestal_mean_{}".format(channel)][ | 
|  | 58 | +                pedestal = table[f"pedestal_mean_{channel}"][ | 
| 59 | 59 |                     table["pixels_id"] == pixel_id | 
| 60 | 60 |                 ][0] | 
| 61 |  | -                rms = table["pedestal_charge_std_{}".format(channel)][ | 
|  | 61 | +                rms = table[f"pedestal_charge_std_{channel}"][ | 
| 62 | 62 |                     table["pixels_id"] == pixel_id | 
| 63 | 63 |                 ][0] | 
| 64 | 64 |                 avgped = np.average(pedestal) | 
|  | 
| 131 | 131 |                     slopes_rms_lg[pixel_id] = slope | 
| 132 | 132 |                 if pixel_id in pixel_display: | 
| 133 | 133 |                     ax.annotate( | 
| 134 |  | -                        "y = {:.4f} T + {:.4f}".format(slope, intercept), | 
|  | 134 | +                        f"y = {slope:.4f} T + {intercept:.4f}", | 
| 135 | 135 |                         (0.05, 0.85 - s * 0.05), | 
| 136 | 136 |                         color=colors[s], | 
| 137 | 137 |                         xycoords="axes fraction", | 
| 138 | 138 |                     ) | 
| 139 | 139 | 
 | 
| 140 | 140 |             if pixel_id in pixel_display: | 
| 141 |  | -                ax.set_title("Pixel {}, NSB OFF".format(pixel_id)) | 
|  | 141 | +                ax.set_title(f"Pixel {pixel_id}, NSB OFF") | 
| 142 | 142 |                 fig.savefig( | 
| 143 |  | -                    "{}/pixel{}_{}.png".format(os.environ["FIGDIR"], pixel_id, k) | 
|  | 143 | +                    f"{os.environ['NECTARCHAIN_FIGURES']}/pixel{pixel_id}_{k}.png" | 
| 144 | 144 |                 ) | 
| 145 | 145 |                 del fig | 
| 146 | 146 |                 plt.close() | 
| 147 | 147 | 
 | 
|  | 148 | +print(f"{flagged_pixels} pixels were flagged as bad by the pedestal estimation tool") | 
| 148 | 149 | print( | 
| 149 |  | -    "{} pixels were flagged as bad by the pedestal estimation tool".format( | 
| 150 |  | -        flagged_pixels | 
| 151 |  | -    ) | 
| 152 |  | -) | 
| 153 |  | -print( | 
| 154 |  | -    "{} pixels were removed because they had a pedestal RMS exceeding {}".format( | 
| 155 |  | -        removed_pixels, rms_threshold | 
| 156 |  | -    ) | 
|  | 150 | +    f"{removed_pixels} pixels were removed because they had a pedestal RMS " | 
|  | 151 | +    f"exceeding {rms_threshold}" | 
| 157 | 152 | ) | 
| 158 | 153 | 
 | 
| 159 | 154 | camera = CameraGeometry.from_name("NectarCam-003") | 
|  | 
| 204 | 199 |         disp.add_colorbar() | 
| 205 | 200 |         disp.update() | 
| 206 | 201 |         ax.set_title("") | 
| 207 |  | -    fig.savefig("{}/camera_{}.png".format(os.environ["FIGDIR"], k)) | 
|  | 202 | +    fig.savefig(f"{os.environ['NECTARCHAIN_FIGURES']}/camera_{k}.png") | 
0 commit comments