Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed some warnings that were being produced, this has made it much convenient to run AniMAIRE using it, and other uses in batch. #1

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading