Skip to content

Commit

Permalink
fixed some warnings that were being produced, this has made it much c…
Browse files Browse the repository at this point in the history
…leaner to run in batch
  • Loading branch information
ChrisSWDavis committed Jan 23, 2025
1 parent 9ca06d2 commit 5d40796
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions atmosphericRadiationDoseAndFlux/doseAndFluxCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from typing import Callable

print("Warning from atmosphericRadiationDoseAndFlux module: currently using an alpha particle as input actually calculates the contribution from alpha + all simulated heavier ions, rather than just alpha particles!")

@settings.allowCalculationForTotalOfParticles
def calculate_from_energy_spec(
inputEnergyDistributionFunctionMeV:Callable,
Expand Down
14 changes: 12 additions & 2 deletions atmosphericRadiationDoseAndFlux/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

import inspect

print("Warning from atmosphericRadiationDoseAndFlux module: currently using an alpha particle as input actually calculates the contribution from alpha + all simulated heavier ions, rather than just alpha particles!")

# import logging
# logger = logging.getLogger('DoseAndFluxCalculatorLogger')
# logger.setLevel(logging.WARNING)

def convertListOrFloatToArray(value)->np.array:
if isinstance(value,np.ndarray):
outputValue = value
Expand Down Expand Up @@ -59,6 +65,8 @@ def totalDoseFlux(*args, **kwargs):

return totalDoseFlux

#alpha_warning_already_printed = False

def formatInputVariables(inputEnergyBins, inputFluxesMeV, altitudesInkm, particleName, verticalCutOffRigidity):
particleForCalculations = Particle(particleName)

Expand All @@ -80,8 +88,10 @@ def formatInputVariables(inputEnergyBins, inputFluxesMeV, altitudesInkm, particl
else:
raise Exception("inputFluxesMeV not specified as a valid type!")

if particleName == "alpha":
print("Warning: currently using an alpha particle as input actually calculates the contribution from alpha + all simulated heavier ions, rather than just alpha particles!")
# if particleName == "alpha" and not (alpha_warning_already_printed):
# print("Warning: currently using an alpha particle as input actually calculates the contribution from alpha + all simulated heavier ions, rather than just alpha particles!")
# alpha_warning_already_printed = True
# #logger.warning("Warning: currently using an alpha particle as input actually calculates the contribution from alpha + all simulated heavier ions, rather than just alpha particles!")

if len(inputEnergyBinsArray) != len(inputFluxesArrayMeV_noVcutOff) + 1:
raise Exception("Number of bins does not match number of flux values!")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
packages=find_packages(exclude='tests'),
package_data={"atmosphericRadiationDoseAndFlux":["atmosphericRadiationDoseAndFlux/data/proton/*.rpf","atmosphericRadiationDoseAndFlux/data/alpha/*.rpf"]},
include_package_data=True,
version='1.0.11',
version='1.0.12',
description='Python library for calculating doses and fluxes at a particular altitude given an input spectrum',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 5d40796

Please sign in to comment.