Skip to content

Commit

Permalink
Add pragma: no cover comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pietsjoh committed Sep 9, 2022
1 parent 28b467f commit ec249d3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions rsciio/jobin_yvon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ def parse_file(self):
_logger.critical(
"File contains multiple positions to read metadata from.\n"
"The first location is choosen."
)
) # pragma: no cover
elif len(lsx_tree_list) == 0:
_logger.critical("No metadata found.")
_logger.critical("No metadata found.") # pragma: no cover
lsx_tree = lsx_tree_list[0]

lsx_matrix_list = root.findall("LSX_Matrix")
if len(lsx_matrix_list) > 1:
_logger.critical(
"File contains multiple positions to read data from.\n"
"The first location is choosen."
)
) # pragma: no cover
elif len(lsx_matrix_list) == 0:
_logger.critical("No data found.")
_logger.critical("No data found.") # pragma: no cover
self._lsx_matrix = lsx_matrix_list[0]

for child in lsx_tree:
Expand All @@ -117,9 +117,9 @@ def parse_file(self):
self._axis_root = child2

if not hasattr(self, "_metadata_root"):
_logger.critical("Could not extract metadata")
_logger.critical("Could not extract metadata") # pragma: no cover
if not hasattr(self, "_axis_root"):
_logger.critical("Could not extract axis")
_logger.critical("Could not extract axis") # pragma: no cover

def _get_metadata_values(self, xml_element, tag):
"""Helper method to extract information from metadata xml-element.
Expand Down Expand Up @@ -246,7 +246,7 @@ def _clean_up_metadata(self):
new_grating_key_name
] = self.original_metadata["experimental_setup"]["Grating"]
del self.original_metadata["experimental_setup"]["Grating"]
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover

## add percentage for filter key name
Expand All @@ -256,7 +256,7 @@ def _clean_up_metadata(self):
new_filter_key_name
] = self.original_metadata["experimental_setup"]["ND Filter"]
del self.original_metadata["experimental_setup"]["ND Filter"]
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover

def get_original_metadata(self):
Expand All @@ -280,11 +280,11 @@ def get_original_metadata(self):
self.original_metadata["experimental_setup"][
"measurement_type"
] = self._measurement_type
except AttributeError: # pragma: no cover
except AttributeError:
pass # pragma: no cover
try:
self.original_metadata["experimental_setup"]["title"] = self._title
except AttributeError: # pragma: no cover
except AttributeError:
pass # pragma: no cover
try:
self.original_metadata["experimental_setup"][
Expand Down Expand Up @@ -419,7 +419,7 @@ def _set_signal_axis(self, xml_element):
elif "/" not in units and units[-1] == "m":
signal_dict["name"] = "Wavelength"
signal_dict["units"] = units
else: # pragma: no cover
else:
_logger.warning(
"Cannot extract type of signal axis from units, using wavelength as name."
) # pragma: no cover
Expand Down Expand Up @@ -463,7 +463,7 @@ def get_data(self):
## lexicographical ordering -> 3x3 map -> 9 rows
num_rows = len(data_raw)
if num_rows == 0:
_logger.critical("No data found.")
_logger.critical("No data found.") # pragma: no cover
elif num_rows == 1:
## Spectrum
self.data = np.fromstring(data_raw[0].text.strip(), sep=" ")
Expand All @@ -485,7 +485,7 @@ def get_data(self):
self.data = np.reshape(
self.data, (self._nav2_size, self._nav1_size, num_cols)
)
else: # pragma: no cover
else:
self.data = np.reshape(
self.data, (self._nav2_size, num_cols)
) # pragma: no cover
Expand Down Expand Up @@ -537,15 +537,15 @@ def map_metadata(self):
date, time = self.original_metadata["date"]["Acquired"].split(" ")
self.metadata["General"]["date"] = date
self.metadata["General"]["time"] = time
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover

try:
intensity_axis = self.original_metadata["experimental_setup"]["signal type"]
intensity_units = self.original_metadata["experimental_setup"][
"signal units"
]
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover
else:
if intensity_axis == "Intens":
Expand Down Expand Up @@ -753,7 +753,7 @@ def map_metadata(self):
self.original_metadata["experimental_setup"]["Accumulations"]
* self.original_metadata["experimental_setup"]["Acq. time (s)"]
)
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover
else:
self.metadata["Acquisition_instrument"]["Detector"][
Expand All @@ -765,16 +765,16 @@ def map_metadata(self):
self.metadata["Acquisition_instrument"]["Laser"]["Filter"][
"optical_density"
] /= 100
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover

## convert angle units from rad to degrees
try:
self.metadata["Acquisition_instrument"]["Spectral_image"][
"rotation_angle"
] *= (180 / np.pi)
except KeyError: # pragma: no cover
pass # pragma: no cover
except KeyError:
pass

## convert entrance_hole_width to mm
try:
Expand All @@ -786,7 +786,7 @@ def map_metadata(self):
] = self.metadata["Acquisition_instrument"]["Spectrometer"][
"entrance_slit_width"
]
except KeyError: # pragma: no cover
except KeyError:
pass # pragma: no cover


Expand Down

0 comments on commit ec249d3

Please sign in to comment.