Skip to content

Commit

Permalink
Make sure to use float().is_integer() everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Feb 19, 2024
1 parent 165e20f commit 6e8df95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sourcespec/ssp_html_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,13 @@ def _add_summary_spectral_params_to_html(config, sspec_output, replacements):
percentile_errors = sspec_output.percentiles_uncertainties()

n_sigma = config.n_sigma
n_sigma = int(n_sigma) if n_sigma.is_integer() else n_sigma
n_sigma = int(n_sigma) if float(n_sigma).is_integer() else n_sigma
n_sigma = f'{n_sigma} sigma'
mid_pct, lower_pct, upper_pct =\
config.mid_percentage, config.lower_percentage, config.upper_percentage
mid_pct = int(mid_pct) if mid_pct.is_integer() else mid_pct
lower_pct = int(lower_pct) if lower_pct.is_integer() else lower_pct
upper_pct = int(upper_pct) if upper_pct.is_integer() else upper_pct
mid_pct = int(mid_pct) if float(mid_pct).is_integer() else mid_pct
lower_pct = int(lower_pct) if float(lower_pct).is_integer() else lower_pct
upper_pct = int(upper_pct) if float(upper_pct).is_integer() else upper_pct
percentages = f'{mid_pct}%, [{lower_pct}%, {upper_pct}%]'
replacements.update({
'{N_SIGMA}': n_sigma,
Expand Down
3 changes: 2 additions & 1 deletion sourcespec/ssp_process_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ def _check_epicentral_distance(config, trace):
if config.epi_dist_ranges is None:
return
# transform integers to true integers, for better string representation
edr = [int(r) if r.is_integer() else r for r in config.epi_dist_ranges]
edr = [
int(r) if float(r).is_integer() else r for r in config.epi_dist_ranges]
# if edr has an odd number of elements, add one last element
if len(edr) % 2 == 1:
edr.append(999999)
Expand Down

0 comments on commit 6e8df95

Please sign in to comment.