Skip to content

Commit

Permalink
Fixed get_channel_energy() -method returning incorrect amount of chan…
Browse files Browse the repository at this point in the history
…nel energy ranges in case of SOHO/EPHIN both before and after 2017-10-04 data product change. Also added a check in dynamic_spectrum() to drop channel 'E300' from the dataframe after the change in data product.
  • Loading branch information
Christian-Palmroos committed Feb 29, 2024
1 parent a2d326f commit 2b5e29a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions seppy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,13 @@ def combine_grids_and_ybins(grid, grid1, y_arr, y_arr1):
s_identifier = "protons"
if instrument.lower() == "ephin":
particle_data = self.current_df_e
# Here drop the E300 channel altogether from the dataframe if the data is produced after Oct 4, 2017,
# for it contains no valid data. Keyword axis==1 refers to the columns axis.
if self.start_date > pd.to_datetime("2017-10-04").date():
particle_data = particle_data.drop("E300", axis=1)

s_identifier = "electrons"
raise Warning('SOHO/EPHIN is not implemented yet in the dynamic spectrum tool!')
# raise Warning('SOHO/EPHIN is not implemented yet in the dynamic spectrum tool!')

if spacecraft == "psp":
if instrument.lower() == "isois-epihi":
Expand Down Expand Up @@ -2285,11 +2290,11 @@ def get_channel_energy_values(self, returns: str = "num") -> list:
energy_ranges = self.current_energies["channels_dict_df_p"]["ch_strings"].values
if self.sensor.lower() == "ephin":
# Choose only the first 4 channels (E150, E300, E1300 and E3000)
# This are the only electron channels (rest p and He), and we
# These are the only electron channels (rest are p and He), and we
# use only electron data here.
energy_ranges = [val for val in self.current_energies.values()][:4]
if self.sensor.lower() in ("ephin-5", "ephin-15"):
energy_ranges = [value for key, value in self.current_energies.items()]
energy_ranges = [value for _, value in self.current_energies.items()]

if self.spacecraft == "psp":
energy_dict = self.meta
Expand Down

0 comments on commit 2b5e29a

Please sign in to comment.