Skip to content

Commit

Permalink
Rearrange checks logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lauraporta committed Oct 23, 2023
1 parent 85df54d commit 0921dd9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions derotation/analysis/derotation_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def process_analog_signals(self):
self.plot_rotation_on_and_ticks_for_inspection()

self.check_number_of_rotations()
if not self.is_number_of_ticks_correct():
if not self.is_number_of_ticks_correct() and self.adjust_increment:
if self.assume_full_rotation:
self.corrected_increments = self.adjust_rotation_increment(
self.rotation_increment
Expand Down Expand Up @@ -260,19 +260,19 @@ def check_number_of_rotations(self):
def is_number_of_ticks_correct(self):
# sanity check for the number of rotation ticks

expected_tiks_per_rotation = (
self.expected_tiks_per_rotation = (
self.rot_deg * self.number_of_rotations / self.rotation_increment
)
found_ticks = len(self.rotation_ticks_peaks)

if expected_tiks_per_rotation == found_ticks:
if self.expected_tiks_per_rotation == found_ticks:
logging.info(f"Number of ticks is as expected: {found_ticks}")
return True
else:
logging.warning(
f"Number of ticks is not as expected: {found_ticks}.\n"
+ f"Expected ticks: {expected_tiks_per_rotation}\n"
+ f"Delta: {found_ticks - expected_tiks_per_rotation}"
+ f"Expected ticks: {self.expected_tiks_per_rotation}\n"
+ f"Delta: {found_ticks - self.expected_tiks_per_rotation}"
)
return False

Expand Down

0 comments on commit 0921dd9

Please sign in to comment.