pymcxray package¶
Subpackages¶
- pymcxray.FileFormat package
- Subpackages
- pymcxray.FileFormat.Results package
- Subpackages
- pymcxray.FileFormat.Results.exported package
- Submodules
- pymcxray.FileFormat.Results.exported.DataMap module
- pymcxray.FileFormat.Results.exported.XrayIntensityXY module
- pymcxray.FileFormat.Results.exported.test_DataMap module
- pymcxray.FileFormat.Results.exported.test_XrayIntensityXY module
- pymcxray.FileFormat.Results.exported.tests module
- Module contents
- pymcxray.FileFormat.Results.exported package
- Submodules
- pymcxray.FileFormat.Results.BaseResults module
- pymcxray.FileFormat.Results.BeamParameters module
- pymcxray.FileFormat.Results.DetectorParameters module
- pymcxray.FileFormat.Results.Dump module
- pymcxray.FileFormat.Results.ElectronExistResults module
- pymcxray.FileFormat.Results.ElectronParameters module
- pymcxray.FileFormat.Results.ElectronResults module
- pymcxray.FileFormat.Results.ElectronTrajectoriesResults module
- pymcxray.FileFormat.Results.ElementParameters module
- pymcxray.FileFormat.Results.Intersections module
- pymcxray.FileFormat.Results.MicroscopeParameters module
- pymcxray.FileFormat.Results.ModelParameters module
- pymcxray.FileFormat.Results.Phirhoz module
- pymcxray.FileFormat.Results.PhirhozElement module
- pymcxray.FileFormat.Results.PhirhozEmittedCharacteristic module
- pymcxray.FileFormat.Results.PhirhozEmittedCharacteristicThinFilm module
- pymcxray.FileFormat.Results.PhirhozGenerated module
- pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic module
- pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristicThinFilm module
- pymcxray.FileFormat.Results.PhirhozRegion module
- pymcxray.FileFormat.Results.RegionParameters module
- pymcxray.FileFormat.Results.RegionVolume module
- pymcxray.FileFormat.Results.SimulationParameters module
- pymcxray.FileFormat.Results.Spectra module
- pymcxray.FileFormat.Results.SpectraEDS module
- pymcxray.FileFormat.Results.Spectrum module
- pymcxray.FileFormat.Results.SpectrumEDS module
- pymcxray.FileFormat.Results.Tags module
- pymcxray.FileFormat.Results.XrayIntensities module
- pymcxray.FileFormat.Results.XraySimulatedSpectraRegion module
- pymcxray.FileFormat.Results.XraySimulatedSpectraSpecimen module
- pymcxray.FileFormat.Results.XraySpectraAtomEmittedDetectedLines module
- pymcxray.FileFormat.Results.XraySpectraRegionEmitted module
- pymcxray.FileFormat.Results.XraySpectraRegionsEmitted module
- pymcxray.FileFormat.Results.XraySpectraSpecimen module
- pymcxray.FileFormat.Results.XraySpectraSpecimenEmittedDetected module
- pymcxray.FileFormat.Results.test_BaseResults module
- pymcxray.FileFormat.Results.test_BeamParameters module
- pymcxray.FileFormat.Results.test_DetectorParameters module
- pymcxray.FileFormat.Results.test_Dump module
- pymcxray.FileFormat.Results.test_ElectronExistResults module
- pymcxray.FileFormat.Results.test_ElectronParameters module
- pymcxray.FileFormat.Results.test_ElectronResults module
- pymcxray.FileFormat.Results.test_ElementParameters module
- pymcxray.FileFormat.Results.test_Intersections module
- pymcxray.FileFormat.Results.test_MicroscopeParameters module
- pymcxray.FileFormat.Results.test_ModelParameters module
- pymcxray.FileFormat.Results.test_Phirhoz module
- pymcxray.FileFormat.Results.test_PhirhozElement module
- pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristic module
- pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristicThinFilm module
- pymcxray.FileFormat.Results.test_PhirhozGenerated module
- pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristic module
- pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristicThinFilm module
- pymcxray.FileFormat.Results.test_PhirhozRegion module
- pymcxray.FileFormat.Results.test_RegionParameters module
- pymcxray.FileFormat.Results.test_RegionVolume module
- pymcxray.FileFormat.Results.test_SimulationParameters module
- pymcxray.FileFormat.Results.test_Spectra module
- pymcxray.FileFormat.Results.test_SpectraEDS module
- pymcxray.FileFormat.Results.test_Spectrum module
- pymcxray.FileFormat.Results.test_Tags module
- pymcxray.FileFormat.Results.test_XrayIntensities module
- pymcxray.FileFormat.Results.test_XraySimulatedSpectraRegion module
- pymcxray.FileFormat.Results.test_XraySimulatedSpectraSpecimen module
- pymcxray.FileFormat.Results.test_XraySpectraAtomEmittedDetectedLines module
- pymcxray.FileFormat.Results.test_XraySpectraRegionEmitted module
- pymcxray.FileFormat.Results.test_XraySpectraRegionsEmitted module
- pymcxray.FileFormat.Results.test_XraySpectraSpecimen module
- pymcxray.FileFormat.Results.test_XraySpectraSpecimenEmittedDetected module
- pymcxray.FileFormat.Results.tests module
- Module contents
- Subpackages
- pymcxray.FileFormat.Results package
- Submodules
- pymcxray.FileFormat.Element module
- pymcxray.FileFormat.ExportedSpectrum module
- pymcxray.FileFormat.FileReaderWriterTools module
- pymcxray.FileFormat.MCXRayModel module
- pymcxray.FileFormat.MicroscopeParameters module
- pymcxray.FileFormat.Models module
- pymcxray.FileFormat.Region module
- pymcxray.FileFormat.RegionDimensions module
- pymcxray.FileFormat.RegionType module
- pymcxray.FileFormat.ResultsParameters module
- pymcxray.FileFormat.SimulationInputs module
- pymcxray.FileFormat.SimulationParameters module
- pymcxray.FileFormat.SnrParameters module
- pymcxray.FileFormat.Specimen module
- pymcxray.FileFormat.Version module
- pymcxray.FileFormat.testUtilities module
- pymcxray.FileFormat.test_Element module
- pymcxray.FileFormat.test_ExportedSpectrum module
- pymcxray.FileFormat.test_FileReaderWriterTools module
- pymcxray.FileFormat.test_MCXRayModel module
- pymcxray.FileFormat.test_MicroscopeParameters module
- pymcxray.FileFormat.test_Models module
- pymcxray.FileFormat.test_Region module
- pymcxray.FileFormat.test_RegionDimensions module
- pymcxray.FileFormat.test_RegionType module
- pymcxray.FileFormat.test_ResultsParameters module
- pymcxray.FileFormat.test_SimulationInputs module
- pymcxray.FileFormat.test_SimulationParameters module
- pymcxray.FileFormat.test_SnrParameters module
- pymcxray.FileFormat.test_Specimen module
- pymcxray.FileFormat.test_Version module
- pymcxray.FileFormat.tests module
- Module contents
- Subpackages
- pymcxray.serialization package
- Submodules
- pymcxray.serialization.SerializationH5py module
- pymcxray.serialization.SerializationNumpy module
- pymcxray.serialization.SerializationPickle module
- pymcxray.serialization.test_Serialization module
- pymcxray.serialization.test_SerializationH5py module
- pymcxray.serialization.test_SerializationNumpy module
- pymcxray.serialization.test_SerializationPickle module
- pymcxray.serialization.tests module
- Module contents
- pymcxray.tests package
Submodules¶
pymcxray.AnalyzeNumberBackgroundWindows module¶
Analyze the number of background windows on the x-ray spectrum.
pymcxray.AtomData module¶
MCXRay atom data.
pymcxray.BatchFile module¶
MCXRay batch file creator.
pymcxray.BatchFileConsole module¶
MCXRay console batch file creator.
-
class
pymcxray.BatchFileConsole.
BatchFileConsole
(name, programName, numberFiles=1)[source]¶ Bases:
object
The batch file is responsible to create the simulation structure with a copy of mcxray program.
One important parameter to set is the numberFiles, this is the number of batch files generated and that can be run in parallel. For maximum efficiency it should be set as the number of logical processors minus 1 or 2. For example, on a computer with 12 logical processors, the numberFiles should be set at 10.
Parameters: - name (str) – Basename used for the batch files
- programName (str) – Name of the executable to add in the batch file
- numberFiles (int) – Number of batch files to generate and possibly to run in parallel
pymcxray.ComparisonModels module¶
Comparison of the models used by MCXray.
pymcxray.DebugSimulatedSpectrum module¶
Debug the simulated spectrum implementation in mcxray.
pymcxray.ElementProperties module¶
-
pymcxray.ElementProperties.
computeAtomicDensity_atom_cm3
(massDensity_g_cm3, atomicMass_g_mol)[source]¶ Compute the atomic density.
\[n_{i} = \frac{N_{A} \rho_{i}}{A_{i}}\]where
- \(n_{i}\) is the atomic density in \(\mathrm{atoms}/cm^{3}\)
- \(N_{A}\) is the Avogadro number in \(\mathrm{atoms}/mole\)
- \(\rho_{i}\) is the mass density in \(g/cm^{3}\)
- \(A_{i}\) is the atomic mass in \(g/mole\)
Parameters: - massDensity_g_cm3 (float) –
- atomicMass_g_mol (float) –
-
pymcxray.ElementProperties.
g_FermiEnergy
= [1.0, 1.0, 4.7, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.1, 1.0, 1.0, 0.555, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 7.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 5.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 5.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0]¶ Fermi energy of element in atomic number order.
For element H to Lr (1-103). From: CASINO source code, DOS version.
Todo
Add units.
-
pymcxray.ElementProperties.
g_atomicMass_g_mol
= [1.0079, 4.0026, 6.941, 9.01218, 10.81, 12.011, 14.0067, 15.9994, 18.998403, 20.179, 22.98977, 24.305, 26.98154, 28.0855, 30.97376, 32.06, 35.453, 39.948, 39.0983, 40.08, 44.9559, 47.9, 50.9415, 51.996, 54.938, 55.847, 58.9332, 58.7, 63.546, 65.38, 69.72, 72.59, 74.9216, 78.96, 79.904, 83.8, 85.4678, 87.62, 88.9056, 91.22, 92.9064, 95.94, 98.0, 101.07, 102.9055, 106.4, 107.868, 112.41, 114.82, 118.69, 121.75, 127.6, 126.9045, 131.3, 132.9054, 137.33, 138.9055, 140.12, 140.9077, 144.24, 145.0, 150.4, 151.96, 157.25, 158.9254, 162.5, 164.9304, 167.26, 168.9342, 173.04, 174.967, 178.49, 180.9479, 183.85, 186.207, 190.2, 192.22, 195.09, 196.9665, 200.59, 204.37, 207.2, 208.9804, 209.0, 210.0, 222.0, 223.0, 226.0254, 227.0278, 232.0381, 231.0359, 238.029, 237.0482, 244.0, 243.0, 247.0, 247.0, 251.0, 252.0, 257.0, 258.0, 259.0, 260.0, 261.0, 262.0, 263.0]¶ Atomic weight of element in atomic number order.
For element H to Sg (1-106).
Unit \(g/mole\).
From: Tableau periodique des elements, Sargent-Welch scientifique Canada Limitee.
-
pymcxray.ElementProperties.
g_kFermi
= [70000000.0, 70000000.0, 110000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 90000000.0, 70000000.0, 70000000.0, 40000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 135000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 119000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 119000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0, 0.0, 70000000.0, 70000000.0, 70000000.0, 70000000.0]¶ Fermi wavelength of element in atomic number order.
For element H to Lr (1–103). From: CASINO source code, DOS version.
Todo
Add units.
-
pymcxray.ElementProperties.
g_massDensity_g_cm3
= [0.0899, 0.1787, 0.53, 1.85, 2.34, 2.62, 1.251, 1.429, 1.696, 0.901, 0.97, 1.74, 2.7, 2.33, 1.82, 2.07, 3.17, 1.784, 0.86, 1.55, 3.0, 4.5, 5.8, 7.19, 7.43, 7.86, 8.9, 8.9, 8.96, 7.14, 5.91, 5.32, 5.72, 4.8, 3.12, 3.74, 1.53, 2.6, 4.5, 6.49, 8.55, 10.2, 11.5, 12.2, 12.4, 12.0, 10.5, 8.65, 7.31, 7.3, 6.68, 6.24, 4.92, 5.89, 1.87, 3.5, 6.7, 6.78, 6.77, 7.0, 6.475, 7.54, 5.26, 7.89, 8.27, 8.54, 8.8, 9.05, 9.33, 6.98, 9.84, 13.1, 16.6, 19.3, 21.0, 22.4, 22.5, 21.4, 19.3, 13.53, 11.85, 11.4, 9.8, 9.4, 1.0, 9.91, 1.0, 5.0, 10.07, 11.7, 15.4, 18.9, 20.4, 19.8, 13.6, 13.511]¶ Mass density of element in atomic number order.
For element H to Cm (1-96).
In \(g/cm{3}\).
From: Tableau periodique des elements, Sargent-Welch scientifique Canada Limitee.
Note
Element Z = 85 and 87 set to 1 for the calculation.
-
pymcxray.ElementProperties.
g_plasmonEnergy
= [15.0, 15.0, 7.1, 18.7, 22.7, 15.0, 15.0, 15.0, 15.0, 15.0, 5.7, 10.3, 15.0, 16.7, 15.0, 15.0, 15.0, 15.0, 3.7, 8.8, 14.0, 17.9, 21.8, 24.9, 21.6, 23.0, 20.9, 20.7, 19.3, 17.2, 13.8, 16.2, 15.0, 15.0, 15.0, 15.0, 3.41, 8.0, 12.5, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 19.2, 15.0, 13.4, 15.2, 17.0, 11.4, 15.0, 2.9, 7.2, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 13.3, 15.0, 15.0, 14.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 35.0, 15.0, 15.0, 15.0, 13.0, 14.2, 15.0, 15.0, 15.0, 15.0, 15.0, 25.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0]¶ Plasmon energy of element in atomic number order.
For element H to Lr (1-103). From: CASINO source code, DOS version.
Todo
Add units.
-
pymcxray.ElementProperties.
getKRatioCorrection
(atomicNumber)[source]¶ Get the constant k ratio correction needed by the mean ionization potential from the atomic number.
Parameters: atomic_number (int) – Atomic number
-
pymcxray.ElementProperties.
getKRatioCorrectionMonsel
(atomicNumber, workFunction_keV)[source]¶ /// K value as defined by Monsel. /// Used in DE/DS calculation. Casino uses K Gauvin,but for low energy, /// JR Lowney says that this one is more appropriate (and by experience, /// it is effectively better for the secondary yield). /// <p> NOTE : Depends on J (ionisation potential). So it must already be calculated before. /// @param element Element for whom we want to calculate the K value. /// @return The K value of the element passed in argument
pymcxray.Simulation module¶
MCXRay simulation parameters.
-
class
pymcxray.Simulation.
Layer
(elements, thickness_nm, mass_density_g_cm3=None)[source]¶ Bases:
object
-
class
pymcxray.Simulation.
Simulation
(overwrite=True)[source]¶ Bases:
object
-
basename
¶
-
beamDiameter_nm
¶
-
beamPosition_nm
¶
-
beamTilt_deg
¶
-
current_A
¶
-
detectorAzimuthalAngle_deg
¶
-
detectorChannelWidth_eV
¶
-
detectorCrystalDistance_cm
¶
-
detectorCrystalRadius_cm
¶
-
detectorCrystalThickness_cm
¶
-
detectorNoise_eV
¶
-
elasticCrossSectionScalingFactor
¶
-
energyLossScalingFactor
¶
-
energy_keV
¶
-
filename
¶
-
modelXrayBremsstrahlung
¶
-
name
¶
-
numberContinuumWindows
¶
-
numberElectrons
¶
-
numberEnergyWindows
¶
-
numberLayersX
¶
-
numberLayersY
¶
-
numberLayersZ
¶
-
numberPhotons
¶
-
resultsBasename
¶
-
solidAngle_sr
¶
-
spectrumInterpolationModel
¶
-
takeOffAngle_deg
¶
-
time_s
¶
-
-
pymcxray.Simulation.
createAlloyBoxInSubstrate
(elementsParticle, elementsSubstrate, boxParameters_nm)[source]¶
-
pymcxray.Simulation.
createAlloyBoxInThinFilm
(elementsParticle, atomicNumberSubstrate, boxParameters_nm, filmThickness_nm)[source]¶
-
pymcxray.Simulation.
createAlloyFilmOverSubstrate
(film_elements, substrate_elements, film_thickness_nm=10.0, film_mass_density_g_cm3=None, substrate_mass_density_g_cm3=None)[source]¶
-
pymcxray.Simulation.
createAlloyParticleInSubstrate
(elementsParticle, atomicNumberSubstrate, particleRadius_nm, particlePositionZ_nm=None)[source]¶
-
pymcxray.Simulation.
createAlloyParticleInThinFilm
(elementsParticle, atomicNumberSubstrate, particleRadius_nm, filmThickness_nm, particlePositionZ_nm=None)[source]¶
-
pymcxray.Simulation.
createBoxFeatureInSubstrate
(feature_elements, substrate_elements, depth_nm, width_nm)[source]¶
-
pymcxray.Simulation.
createFilmInSubstrate
(atomicNumberFilm, atomicNumberSubstrate, filmThickness_nm, filmTopPositionZ_nm)[source]¶
-
pymcxray.Simulation.
createFilmOverSubstrate
(atomicNumberFilm, atomicNumberSubstrate, filmThickness_nm=10.0)[source]¶
-
pymcxray.Simulation.
createParticleInSubstrate
(atomicNumberParticle, atomicNumberSubstrate, particleRadius_nm, particlePositionZ_nm=None)[source]¶
-
pymcxray.Simulation.
createParticleOnFilm
(atomicNumberParticle, atomicNumberSubstrate, particleDiameter_nm, filmThiskness_nm)[source]¶
-
pymcxray.Simulation.
createParticleOnSubstrate
(atomicNumberParticle, atomicNumberSubstrate, particleDiameter_nm)[source]¶
-
pymcxray.Simulation.
createPhirhozSpecimens
(atomicNumberTracer, atomicNumberMatrix, tracerThickness_nm, maximumThickness_nm)[source]¶
-
pymcxray.Simulation.
create_cnt_sample
(body_elements, cnt_length_nm=1000.0, cnt_outside_diameter_nm=100.0, cnt_inside_diameter_nm=50.0, particle_diameter_nm=5.0)[source]¶
-
pymcxray.Simulation.
create_multi_horizontal_layer
(substrate_elements, layers, substrate_mass_density_g_cm3=None)[source]¶ Create a horizontal multi layer sample.
The substrate is the first region created. The other region are each of the element in the layers.
Parameters: - substrate_elements – list of atomic number and weight fraction pair for the composition of the substrate
- layers –
- substrate_mass_density_g_cm3 –
Returns:
pymcxray.SimulationsParameters module¶
Simulations parameters
pymcxray.Testings module¶
pymcxray.mcxray module¶
Base module to create and analuyze MCXRay simulations.
pymcxray.multipleloop module¶
This module provides a tool for handling computer experiments with of a set of input parameters, where each input parameter is varied in a prescribed fashion.
In short, the parameters are held in a dictionary where the keys are the names of the parameters and the values are the numerical, string or other values of the parameters. The value can take on multiple values: e.g., an integer parameter ‘a’ can have values -1, 1 and 10. Similarly, a string parameter ‘method’ can have values ‘Newton’ and ‘Bisection’. The module will generate all combination of all parameters and values, which in the mentioned example will be (-1, ‘Newton’), (1, ‘Newton’), (10, ‘Newton’), (-1, ‘Bisection’), (1, ‘Bisection’), and (10, ‘Bisection’). Particular combination of values can easily be removed.
The usage and implementation of the module are documented in the book “Python Scripting for Computational Science” (H. P. Langtangen, Springer, 2009), Chapter 12.1.
-
pymcxray.multipleloop.
combine
(prm_values)[source]¶ Compute the combination of all parameter values in the prm_values (nested) list. Main function in this module.
param prm_values: nested list
(parameter_name, list_of_parameter_values)
or dictionaryprm_values[parameter_name] = list_of_parameter_values
. return: (all, names, varied) where- all contains all combinations (experiments) all[i] is the list of individual parameter values in experiment no i
- names contains a list of all parameter names
- varied holds a list of parameter names that are varied (i.e. where there is more than one value of the parameter, the rest of the parameters have fixed values)
Code example:
>>> dx = array([1.0/2**k for k in range(2,5)]) >>> dt = 3*dx; dt = dt[:-1] >>> p = {'dx': dx, 'dt': dt} >>> p {'dt': [ 0.75 , 0.375,], 'dx': [ 0.25 , 0.125 , 0.0625,]} >>> all, names, varied = combine(p) >>> all [[0.75, 0.25], [0.375, 0.25], [0.75, 0.125], [0.375, 0.125], [0.75, 0.0625], [0.375, 0.0625]]
pymcxray.pymcxray module¶
pymcxray.test_AtomData module¶
Tests for the module AtomData.
-
class
pymcxray.test_AtomData.
TestAtomData
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module AtomData.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.test_BatchFileConsole module¶
Tests for the module BatchFileConsole.
-
class
pymcxray.test_BatchFileConsole.
TestBatchFileConsole
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module BatchFileConsole.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.test_ComparisonModels module¶
Tests for the module ComparisonModels.
-
class
pymcxray.test_ComparisonModels.
TestComparisonModels
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module ComparisonModels.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.test_Simulation module¶
Tests for the module Simulation.
-
class
pymcxray.test_Simulation.
TestSimulation
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Simulation.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.test_SimulationsParameters module¶
Tests for the module SimulationsParameters.
-
class
pymcxray.test_SimulationsParameters.
TestSimulationsParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module SimulationsParameters.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.test_mcxray module¶
Tests for the module mcxray.
-
class
pymcxray.test_mcxray.
Testmcxray
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module mcxray.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
pymcxray.tests module¶
Module contents¶
-
pymcxray.
create_path
(path)[source]¶ Create a path from the input string if does not exists.
Does not try to distinct between file and directory in the input string. path = “dir1/filename.ext” => “dir1/filename.ext/” where the new directory “filename.ext” is created.
Parameters: path (str) – The path input string. Returns: The path with the path separator at the end Return type: str
-
pymcxray.
find_all_files
(root, patterns='*', ignore_path_patterns='', ignore_name_patterns='', single_level=False, yield_folders=False)[source]¶ Find all files in a root folder.
From Python Cookbook section 2.16 pages 88–90
Parameters: - root –
- patterns –
- ignore_path_patterns –
- ignore_name_patterns –
- single_level –
- yield_folders –
Returns:
-
pymcxray.
get_current_module_path
(module_path, relative_path='')[source]¶ Extract the current module path and combine it with the relative path and return it.
Parameters: - module_path (str) – Pass the __FILE__ python keyword for this parameter
- relative_path (str) – The relative path to combine with the module path
Returns: The path obtained when combine the module path and relative path
Return type: str
-
pymcxray.
get_mcxray_archive_name
(configuration_file_path, default=None)[source]¶ Read the MCXRay archive name in the configuration file. This option allows to choose which version of MCXRay to use for the simulations.
The configuration file need to have this entry in the section [Paths]:
[Paths] mcxrayArchiveName=2016-04-11_11h41m28s_MCXRay_v1.6.6.0.zip
Parameters: - configuration_file_path (str) – The file path of the configuration file
- default (str) – Default value to use if the entry is not found
Returns: The MCXRay archive name
Return type: str
-
pymcxray.
get_mcxray_archive_path
(configuration_file_path, relative_path='')[source]¶ Read the MCXRay archive path in the configuration file.
The configuration file need to have this entry in the section [Paths]:
[Paths] mcxrayArchivePath=D:\Dropbox\hdemers\professional\softwareRelease\mcxray
Parameters: - configuration_file_path (str) – The file path of the configuration file
- relative_path (str) – Relative path to add to the path read in the configuration file
Returns: Path where the mcxray archive can be found.
Return type: str
-
pymcxray.
get_mcxray_program_name
(configuration_file_path, default=None)[source]¶ Read the MCXRay program name in the configuration file.
This option specify which executable to use in the script. The console_mcxray_x64.exe should be OK for most situation. If you have a 32-bit system, you have to use console_mcxray.exe (32-bit version).
The configuration file need to have this entry in the section [Paths]:
[Paths] mcxrayProgramName=console_mcxray_x64.exe
Parameters: - configuration_file_path (str) – The fule path of the configuration file
- default (str) – Default value to use if the entry is not found
Returns: The MCXRay program name
Return type: str
-
pymcxray.
get_mcxray_program_path
(configuration_file_path, relative_path='')[source]¶ Read the MCXRay program path in the configuration file.
The configuration file need to have this entry in the section [Paths]:
[Paths] mcxrayProgramPath=C:\hdemers\codings\devcasino
Parameters: - configuration_file_path (str) – The file path of the configuration file
- relative_path (str) – Relative path to add to the path read in the configuration file
Returns: Path where the mcxray program can be found.
Return type: str
Deprecated since version 0.1.
See also
function
pymcxray.get_mcxray_archive_path()
-
pymcxray.
get_results_mcgill_path
(configuration_file_path, relative_path='')[source]¶ Read the results path for McGill in the configuration file. The results path read in the configuration file is combine with the relative_path and return.
The configuration file need to have this entry in the section [Paths]:
[Paths] resultsMcGillPath=D:\Dropbox\hdemers\professional\results\simulations
Parameters: - configuration_file_path (str) – The file path of the configuration file
- relative_path (str) – Relative path to add to the path read in the configuration file
Returns: Path where the simulation input and results will be written
Return type: str
-
pymcxray.
read_value_from_configuration_file
(configuration_file, section_name, key_name, default=None)[source]¶ Read a value from an entry in a section from a configuration file.
Parameters: - configuration_file (str) – The file path of the configuration file
- section_name (str) – Name of the section
- key_name (str) – Name of the entry to read
- default – Default value of the entry if not found
Returns: The value read or default value
Return type: str