Development

Introduction

This section is provided for developer who are interested in extending the functionality of the GeoEfficiency package or just make use of some of its functionality. this software is licensed under the MIT license.

Configuration

The package contain many parameters that can be set within the program sourcecode. they can be found in the source file Config.jl

parameterdescriptiondefault value
dataFoldername of the root directory"GeoEfficiency"
dataDirroot directoryjoinpath(homedir(), dataFolder)
integrateuse the package QuadGK to perform integrationbegin using QuadGK; QuadGK.quadgk; end
relativeError1.0E-4
absoluteErroreps(1.0)
resultsFoldername of the result directory inside the root directory"results"
max_displaydefine the default for maximum number of entries shown in the console in batch mode20 see max_batch

Error System

custom abstract Exception that is the parent of all Exception in the GeoEfficiency package

source

custom Exception indicating invalid radiation detector dimensions

source
@validateDetector cond [text]

throw an InValidDetectorDim if cond is false. Message text is optionally displayed upon validation failure.

Examples

julia> @validateDetector iseven(3) "3 is an odd number!"
ERROR: InValidDetectorDim: 3 is an odd number!

julia> @validateDetector isodd(3) "What even are numbers?"
source

custom Exception indicating a not valid source to detector geometry

source
@inValidGeometry [msg]

custom macro to throw NotImplementedError Exception.

source

custom Exception indicating a source-to-detector geometry which may be valid but not implemented yet

source
@notImplementedError [msg]

custom macro to throw NotImplementedError Exception.

source

Console Input

Julia language is quite reach language but it seems a good idea thought to collect repeated tasks involving input from console in compact and customized to the need function. this section provide two essential functions to deal with inputs from the console. the first:

GeoEfficiency.inputFunction.

UnExported

input(prompt::AbstractString = "?: ", incolor::Symbol = :green)

return a string represent the user respond delimited by new line excluding the new line. prompt the user with the massage prompt defaults to ?. wait until the user type its respond and press return. incolor specify the prompt text color, default to $:green$ may take any of the values :black, :blue, :cyan, :green, :light_black, :light_blue, :light_cyan, :light_green, :light_magenta, :light_red, :light_yellow, :magenta, :red, :white, or :yellow.

Color
	The effect of color is not allways respected in all teriminals as some color may be simplly 
	ignored by some teriminals.
source

while the second is a more complex function:

UnExported

getfloat(prompt::AbstractString = "?: ", from::Real = -Inf, to::Real = Inf; KW...)::Float64

prompts the user with the massage prompt defaults to ?: to input a numerical expression evaluate to a numerical value. check that the numerical value is in interval [from, to[ by default [-∞, ∞[ before returning it as a Float64. throws ArgumentError when the given interval is not valid. if the numerical expression fail to evaluated to numerical value or the numerical value is not in the valid interval the function will warn the user and reprompt him to give a valid expresion.

KW arguments

  • value::AbstractString="nothing" : if provided the function will not ask for input from the console and take it as if it where inputted from the console [for test propose mainly].
  • lower::Bool=true : whether or not to inculde from as accepted value.
  • upper::Bool=false : whether or not to inculde to as accepted value.
Note
	A blank input (i.e just a return) is considered as being `0.0`. 
	Input from the `console` can be numerical expression not just a number. 
	expression like ``5/2`` ; ``5//2`` ; ``pi`` ; ``π/2`` ; ``exp(2)`` ; ``1E-2 `` ; ``5.2/3`` ; 
	``sin(1)`` ;  ``sin(1)^2`` are all valid expressions.

Examples

julia> getfloat("input a number:", value="3")
3.0

julia> getfloat("input a number:", value="")
0.0

julia> getfloat("input a number:", value="5/2")
2.5

julia> getfloat("input a number:", value="5//2")
2.5

julia> getfloat("input a number:", value="pi")
3.141592653589793

julia> getfloat("input a number:", value="-2")
-2.0

julia> getfloat("input a number:", value="sin(1)^2")
0.7080734182735712

julia> getfloat("input a number:", 1, 5, value="5", upper=true)
5.0
source

Those function are not exported that is normally the user will not need to use them but they are documented here to allow a developer ranked user to make use of them.

Physics Model

Two abstract detector types defined in the package to classify the detectors, the top most super type,

abstract super-supertype of all detectors types

source

any future detector definition should inherit from RadiationDetector. The second abstract detector Detector is also a sub-type of RadiationDetector but it only accommodates cylindrical type only.

Detector

abstract supertype of all detectors types of cylidericalish shapes. also can be used to construct any leaf type.

source

can be used to construct leaf detector.

Detector()

construct and return an object of the Detector leaf types (CylDetector, BoreDetector or WellDetector) according to the input from the console.

Note

all required information is acquired from the console and would warn user on invalid data.

source

also it can be used to construct a concrete detector depend on the provided arguments.

Detector(CryRadius::Real, CryLength::Real, HoleRadius::Real, HoleDepth::Real)

construct and return well-type, bore-hole or cylindrical detector according to the arguments. it inspect the arguments and call the appropriate leaf type constructor.

Missing Argument(s)

if the value(s) of the last argument(s) isre zero, it acts as a missing argument(s).

see also: CylDetector, BoreDetector, WellDetector.

source
Detector(CryRadius::Real)

same as CylDetector(CryRadius::Real).

source
Detector(CryRadius::Real, CryLength::Real)

same as CylDetector(CryRadius::Real, CryLength::Real).

source
Detector(CryRadius::Real, CryLength::Real, HoleRadius::Real)

same as BoreDetector(CryRadius::Real, CryLength::Real, HoleRadius::Real) except when HoleRadius = 0.0 it acts as CylDetector(CryRadius::Real, CryLength::Real).

source

Batch Mode Input

UnExported

 detector_info_from_csvFile(detectors::AbstractString = Detectors, 
                                  datadir::AbstractString = dataDir)

return a vector{Detector} based on information in the file of name detectors found in the directory datadir.

Note
  • if no path is given the second argument datadir is default to C:\Users\Mohamed\GeoEfficiency as set by the constant dataDir.
  • if no file name is specified the name of the predefined file Detectors.csv as set by the constant Detectors.
  • the no argument method is the most useful; other methods are mainly for test propose.
source

UnExported

read_from_csvFile(csv_data::AbstractString, 
                   datadir::AbstractString = dataDir)::Vector{Float64}

return Vector{Float64} based on data in csv file named csv_data. directory datadir point to where the file is located default to $C:\Users\Mohamed\GeoEfficiency$ as set by the constant dataDir.

source

UnExported

read_batch_info()

read detectors and sources parameters from the predefined csv files.

Return a tuple (detectorsarray, srcHeightsarray, srcRhosarray, srcRadiiarray, srcLengthsarray, GeoEfficiencyisPoint)

source

UnExported

read_batch_info(datadir::AbstractString,
              detectors::AbstractString, 
             srcHeights::AbstractString,
                srcRhos::AbstractString,
               srcRadii::AbstractString,
             srcLengths::AbstractString)

read detectors and sources parameters from the location given in the argument list.

Return a tuple

   (detectors_array,
	srcHeights_array,
	srcRhos_array,
	srcRadii_array,
	srcLengths_array,
	isPoint)
source
getDetectors(detectors_array::Vector{<:Detector} = Detector[])::Vector{Detector}

return the detectors_array as Vector{Detector} extended by the entered detectors and sorted according to the detector volume. prompt the user to input detector parameters from the console.

Note

If no array received in the input an empty array will be created to receive the converted detectors.

source
getDetectors(detector_info_array::Matrix{<:Real}, 
				 detectors_array::Vector{<:Detector} = Detector[]; 
				 						   console_FB=true)::Vector{Detector}

return detectors_array as Vector{Detector}, after extending it with the successfully converted detectors. while, attempt to convert detectors from the information in detector_info_array.

Note

if console_FB argument is set to true , the function will call getDetectors() to take input from the console if the detector_info_array is empty or contain no numerical element.

source

Output Interface

UnExported

checkResultsDirs()

make sure that directories for saving the results are already exist or create them if necessary.

source

UnExported

writecsv_head(filename::AbstractString, content::VecOrMat{<:Union{Int,Float64}}, head=[])

Write content to the comma delimited values file filename. optionally with header head.

source

Global variable that give a hint to the program on maxumam number of entries per detector displayed on the console in btach mode.

Special Values
Negative value will display prevent batch results from printed to the `console`. 
while `Inf` will print all batch results to the `console`.
source

set the default value for the global variable _max_batch

source
GeoEfficiency._batchFunction.

UnExported

_batch(
	::Val{true},
	detector::Detector,
	srcHeights_array::Vector{Float64},
	srcRhos_array::Vector{Float64},
	srcRadii_array::Vector{Float64},
	srcLengths_array::Vector{Float64}
	)

batch calculation for specialized for point sources. return a tuple of three arrays the detector, the resultsand the path of the CSV file containing results.

The results has columns of headers Height, Rho, GeoEfficiency.

Note

for all arrays srcHeights_array, srcRhos_array, srcRadii_array and srcLengths_array element type should be Float64. if any of them have other numerical element type it should converted to Float64 using float before passing it to this method.

Warning

both srcRadii_array, srcLengths_array are completely ignored as this method is for point sources.

source

UnExported

_batch(
	::Val{false},
	detector::Detector,
	srcHeights_array::Vector{Float64},
	srcRhos_array::Vector{Float64},
	srcRadii_array::Vector{Float64},
	srcLengths_array::Vector{Float64},
	)

batch calculation for specialized for non-point sources. return a tuple of three arrays the detector, the resultsand the path of the CSV file containing results.

The results has columns of headers AnchorHeight, AnchorRho, srcRadius, srcLength, GeoEfficiency.

Note

for all arrays srcHeights_array, srcRhos_array, srcRadii_array and srcLengths_array element type should be Float64. if any of them have other numerical element type it should converted to Float64 using float before passing it to this method.

source