Skip to content

Commit

Permalink
Merge pull request #194 from chummels/pbar
Browse files Browse the repository at this point in the history
Fixing off-by-one on progress bar
  • Loading branch information
chummels committed Mar 30, 2023
2 parents ae833d4 + 1a3e63a commit 3944223
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions trident/absorption_spectrum/absorption_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def _add_continua_to_spectrum(self, field_data, use_peculiar_velocity,
continuum['index']) * \
(column_density[lixel] / continuum['normalization'])
self.tau_field[left_index[lixel]:right_index[lixel]] += cont_tau.d
pbar.update(i)
pbar.update()
pbar.finish()

def _add_lines_to_spectrum(self, field_data, use_peculiar_velocity,
Expand Down Expand Up @@ -814,7 +814,7 @@ def _add_lines_to_spectrum(self, field_data, use_peculiar_velocity,
# if there is a ray element with temperature = 0 or column
# density = 0, skip it
if (thermal_b[i] == 0.) or (cdens[i] == 0.):
pbar.update(i)
pbar.update()
continue

# the virtual window into which the line is deposited initially
Expand Down Expand Up @@ -915,7 +915,7 @@ def _add_lines_to_spectrum(self, field_data, use_peculiar_velocity,
window_width_in_bins *= 2

if center_index is None:
pbar.update(i)
pbar.update()
continue

# Numerically integrate the virtual bins to calculate a
Expand All @@ -941,7 +941,7 @@ def _add_lines_to_spectrum(self, field_data, use_peculiar_velocity,
# all then skip the deposition
if ((left_index >= self.lambda_field.size) or \
(right_index < 0)):
pbar.update(i)
pbar.update()
continue

# otherwise, determine how much of the original spectrum
Expand Down Expand Up @@ -975,7 +975,7 @@ def _add_lines_to_spectrum(self, field_data, use_peculiar_velocity,
'redshift': redshift[i],
'redshift_eff': redshift_eff[i],
'v_pec': peculiar_velocity})
pbar.update(i)
pbar.update()
pbar.finish()

# Expand the tau_field array to match the updated wavelength
Expand Down

0 comments on commit 3944223

Please sign in to comment.