Welcome to pymcxray’s documentation!¶
Contents:
pymcxray¶
Python scripts for using mcxray software
- Free software: Apache Software License 2.0
- Documentation: https://pymcxray.readthedocs.io.
Features¶
- TODO
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
Stable release¶
Todo
Add pypi installation for this project.
Warning
Right now, the Stable release installation does not work.
To install pymcxray, run this command in your terminal:
$ pip install pymcxray
This is the preferred method to install pymcxray, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
For developer¶
Clone the public repository:
$ git clone git://github.com/drix00/pymcxray
Go in the project folder and install it with pip in developer mode:
$ cd pymcxray
$ pip install -e .
Note
The project use Git LFS for the test data file. Follow the information on Git LFS to get the test data when the repository is pull.
From sources¶
The sources for pymcxray can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/drix00/pymcxray
Or download the tarball:
$ curl -OL https://github.com/drix00/pymcxray/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Usage¶
To use pymcxray in a project look in the examples folder.
To run the example, you need to specify the task you want to do.
$python simulation_test_maps.py generate
Note
On windows use the py
command and not python
if you have more than one python version installed.
Currently these tasks are available:
generate
check
read
analyze
scheduled_read
At first, the script may look complex, but starting with a previous script it is easy to create a new script for you simulation.
Each script has two parts:
- a class that subclass mcxray._Simulations were
- the simulation parameters are specified
- results needed extracted from the simulation
- analysis of the results can be done (this can be also done in another script)
- a main section were
- batch files are generated for the simulation
- the different task are selected using commend line argument.
Note
These two parts could be separate in two python script (file) without problem. But it seem more logical to kept them together and only have one python script file.
simulation_test_maps¶
To explain this example, we are going to start from the main section.
The batch file is define in a run method, which is called by the __main__, i.e., only run if the script is called from the command line, but not run if imported.
When the script is ready, these task are run in that order:
generate
check
read
analyze
$python simulation_test_maps.py generate
Start the batch files in parallel. It is easier to just select them all in Windows Explorer and right-click and open them.
BatchSimulationTestMapsMM2017_1.bat
BatchSimulationTestMapsMM2017_2.bat
To check the progress of all simulations, i.e., how many simulations are done and todo
$python simulation_test_maps.py check
When all simulations are done, extract the results and save it in a hdf5 file.
$python simulation_test_maps.py read
The specified results can be analysed using the script (from the hdf5 file) or analysed using another script. For example, xray-spectrum-modeling project analyse the hdf5 file generate by this script.
An alternative to use the command line argument for these tasks, it to add them directly in the script and uncommenting the task you want to run in the main section of the script.
if __name__ == '__main__': #pragma: no cover
import sys
...
if len(sys.argv) == 1:
sys.argv.append(mcxray.ANALYZE_TYPE_GENERATE_INPUT_FILE)
#sys.argv.append(mcxray.ANALYZE_TYPE_CHECK_PROGRESS)
#sys.argv.append(mcxray.ANALYZE_TYPE_ANALYZE_RESULTS)
#sys.argv.append(mcxray.ANALYZE_TYPE_ANALYZE_SCHEDULED_READ)
...
By default the logging level is set at logging.WARN and above, but pymcxray gives a lot information at the logging.INFO level so it is recommanded to set the logger level as follow
...
logging.getLogger().setLevel(logging.INFO)
...
The complete __main__ is given below
if __name__ == '__main__': #pragma: no cover
import sys
logging.getLogger().setLevel(logging.INFO)
logging.info(sys.argv)
if len(sys.argv) == 1:
sys.argv.append(mcxray.ANALYZE_TYPE_GENERATE_INPUT_FILE)
#sys.argv.append(mcxray.ANALYZE_TYPE_CHECK_PROGRESS)
#sys.argv.append(mcxray.ANALYZE_TYPE_ANALYZE_RESULTS)
#sys.argv.append(mcxray.ANALYZE_TYPE_ANALYZE_SCHEDULED_READ)
run()
The run
method have three components
- a configuration file, see Configuration file
- a batch file object, see Batch file
- one or more simulation subclass, see Simulation subclass
Here is a example of a complete run
method
def run():
# import the batch file class.
from pymcxray.BatchFileConsole import BatchFileConsole
# Find the configuration file path
configuration_file_path = get_current_module_path(__file__, "MCXRay_latest.cfg")
program_name = get_mcxray_program_name(configuration_file_path)
# Create the batch file object.
batch_file = BatchFileConsole("BatchSimulationTestMapsMM2017", program_name, numberFiles=10)
# Create the simulation object and add the batch file object to it.
analyze = SimulationTestMapsMM2017(relativePath=r"mcxray/SimulationTestMapsMM2017",
configurationFilepath=configuration_file_path)
analyze.run(batch_file)
Configuration file¶
The configuration file is a ini style configuration file for using pymcxray. It define the paths needed to generate and run the simulations.
[Paths]
mcxrayProgramName=console_mcxray_x64.exe
resultsMcGillPath=D:\Dropbox\hdemers\professional\results\simulations
mcxrayArchivePath=D:\Dropbox\hdemers\professional\softwareRelease\mcxray
mcxrayArchiveName=2016-04-11_11h41m28s_MCXRay_v1.6.6.0.zip
See the documentation of these functions for more detail on each option
Batch file¶
The batch file is responsible to create the simulation structure with a copy of mcxray program. Batch files are generated to easily run the simulations. 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.
See pymcxray.BatchFileConsole.BatchFileConsole
documentation for more information about the other parameters.
Simulation subclass¶
The simulation subclass allows to generate a lot of simulations by varying simulations parameters.
The main features are
- generate input files
- regenerate input files of simulations not done
- check the progress of the simulations: done and todo
- extract results from the completed simulation
- save the results in a hdf5 file for easier analysis
- optionally do the analysis of the results
To do that the user need to subclass pymcxray.mcxray._Simulations
and overwrite these method
pymcxray.mcxray._Simulations._initData()
(required)pymcxray.mcxray._Simulations.getAnalysisName()
(required)pymcxray.mcxray._Simulations.createSpecimen()
(required)pymcxray.mcxray._Simulations.read_one_results_hdf5()
(optional)pymcxray.mcxray._Simulations.analyze_results_hdf5()
(optional)
Warning
If any of the required method is modified, the simulation have to be redone completely. It is recommended to just delete the root path for the analysis and generate the input files and do the simulations. For this example, delete SimulationTestMapsMM2017 folder.
Warning
If pymcxray.mcxray._Simulations.read_one_results_hdf5()
is modified.
In some case, the hdf5 need to be deleted.1
Furthermore, if the results were deleted: delete_result_files is True, the simulation have to be redone.
Below are given example for each method, for more detail see the method documentation.
Init data¶
This method is used to specify the options for the analysis and also the parameters used in the simulations.
The most important options for the anslysis are:
- use_hdf5 to use the recommended hdf5 method. If it is False the older serial method will be used.
- delete_result_files if it is True, the result file are deleted after added in the hdf5 file. Very useful when creating a lot files like for a map.
- createBackup if True create a backup of the hdf5 file before adding more results to it. Usefull to not loss data in case of error or crash, but you should delete backup file manually as they can take a lot of space.
Warning
If delete_result_files is True, all results are deleted for a simulation and only the results specified in pymcxray.mcxray._Simulations.read_one_results_hdf5()
are kept.
If pymcxray.mcxray._Simulations.read_one_results_hdf5()
is modified to extract more results, the simulation have to be simulate again.
This is the recommended values for the options, only change them when you are sure everything is working OK.
def _initData(self):
self.use_hdf5 = True
self.delete_result_files = False
self.createBackup = True
The simulation parameters are specified in this method.
Note
If not specified, the script use MCXRay default parameters. Start MCXRay program to see the default value of each parameters.
To change simulation parameters, create a pymcxray.SimulationsParameters.SimulationsParameters
object
self._simulationsParameters = SimulationsParameters()
Two kinds of parameter can be added:
- varied specified with a list of values
- fixed specified with a single value
The script will automatically generate a simulation for all combination of the varied parameters.
Warning
Adding a lot of varied parameters with a lot of values can generate a lot of simulations. Above 1000 simulations, all tasks of the script will be slow because of the generation or reading of a lot of files. It is recommended to start with 2 or 3 varied parameters and short list of values and test all tasks of the script. When the tests are OK and results make sense, you can increase the list of values. To add more varied parameters, it is receommended to create a new script with again only 2 or 3 varied parameters.
The parameters that can be added are defined as keyword starting with PARAMETER_ in the module pymcxray.SimulationsParameters
.
If you don’t find the parameter you want request an “enhancement” at https://github.com/drix00/pymcxray/issues.
Here is an example how-to add simulation parameters
from pymcxray.SimulationsParameters import SimulationsParameters, PARAMETER_INCIDENT_ENERGY_keV, PARAMETER_NUMBER_ELECTRONS, \
PARAMETER_BEAM_POSITION_nm, PARAMETER_NUMBER_XRAYS
...
class SimulationTestMapsMM2017(mcxray._Simulations):
def _initData(self):
...
# Local variables for value and list if values.
energy_keV = 30.0
number_electrons = 10000
#number_xrays_list = [10, 20, 30, 50, 60, 100, 200, 500, 1000]
number_xrays_list = [10]
xs_nm = np.linspace(-5.0e3, 5.0e3, 3)
probePositions_nm = [tuple(position_nm) for position_nm in np.transpose([np.tile(xs_nm, len(xs_nm)), np.repeat(xs_nm, len(xs_nm))]).tolist()]
# Simulation parameters
self._simulationsParameters = SimulationsParameters()
self._simulationsParameters.addVaried(PARAMETER_NUMBER_XRAYS, number_xrays_list)
self._simulationsParameters.addVaried(PARAMETER_BEAM_POSITION_nm, probePositions_nm)
self._simulationsParameters.addFixed(PARAMETER_INCIDENT_ENERGY_keV, energy_keV)
self._simulationsParameters.addFixed(PARAMETER_NUMBER_ELECTRONS, number_electrons)
Analysis name¶
This method specify the name of the analysis or experiment for which the simulation are done. Normally similar to the name of the class and mostly used as basename for the input files and result files. In case of two scripts writing the same path, it allows to differentiate them, but it is not recommended to run two scripts in the same folde.
class SimulationTestMapsMM2017(mcxray._Simulations):
...
def getAnalysisName(self):
return "SimulationTestMapsMM2017"
...
Create specimen¶
This method is used to create the specimen for each simulation.
The argument of the method contains the option of the specific simulation and can be used to create the specimen.
The pymcxray.Simulation.Simulation
module contains predefined specimen which can be use in this method.
Here an example how-to use the parameters argument and the predefined specimen
def createSpecimen(self, parameters):
weightFractions = parameters[PARAMETER_WEIGHT_FRACTIONS]
elements = [(self.atomicNumberA, weightFractions[0]),
(self.atomicNumberB, weightFractions[1])]
specimen = Simulation.createAlloyBulkSample(elements)
return specimen
A more complex example, where each region are specified is given below
def createSpecimen(self, parameters):
# Create the specimen with a name and number of regions.
specimen = Specimen.Specimen()
specimen.name = "Maps01"
specimen.numberRegions = 10
# Region 0
region = Region.Region()
region.numberElements = 0
region.regionType = RegionType.REGION_TYPE_BOX
parameters = [-10000000000.0, 10000000000.0, -10000000000.0, 10000000000.0, 0.0, 20000000000.0]
region.regionDimensions = RegionDimensions.RegionDimensionsBox(parameters)
specimen.regions.append(region)
# Region 1
region = Region.Region()
region.numberElements = 2
region.elements = [Element.Element(27, massFraction=0.01), Element.Element(26, massFraction=0.99)]
region.regionType = RegionType.REGION_TYPE_BOX
parameters = [-7.5e4, -2.5e4, -7.5e4, -2.5e4, 0.0, 0.2e4]
region.regionDimensions = RegionDimensions.RegionDimensionsBox(parameters)
specimen.regions.append(region)
...
Warning
Creating a specimen in MCXRay is complicate as sometime you need to create a empty region 0.
Look at the predefined specimen in pymcxray.Simulation.Simulation
for help.
Drawing the trajectory with the FileFormat.Results.ElectronTrajectoriesResults
will help debug the specimen.
You can also request a “help wanted” at https://github.com/drix00/pymcxray/issues.
Read one simulation results¶
This method extract results from one complete simulation and added them in a hdf5 group for this simulation.
The result that can be extracted are in the package pymcxray.FileFormat.Results
and only the class implementing write_hdf5()
can be extracted.
If the desired results does not implement the write_hdf5()
method, request an “enhancement” at https://github.com/drix00/pymcxray/issues.
Note
The format of the hdf5 file is not well documented.
Check the implementation of the write_hdf5()
method and request an “enhancement”
at https://github.com/drix00/pymcxray/issues for the documentation.
Note
The program HDFView is useful to look at the hdf5 file. See https://support.hdfgroup.org/products/java/hdfview/.
Here is an example how-to extract the electron results (BSE, TE, …)
def read_one_results_hdf5(self, simulation, hdf5_group):
electronResults = ElectronResults.ElectronResults()
electronResults.path = self.getSimulationsPath()
electronResults.basename = simulation.resultsBasename
electronResults.read()
electronResults.write_hdf5(hdf5_group)
So far this class are implemented with hdf5 support
pymcxray.FileFormat.Results.ElectronResults.ElectronResults
pymcxray.FileFormat.Results.PhirhozEmittedCharacteristic.PhirhozEmittedCharacteristic
pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic.PhirhozGeneratedCharacteristic
pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristicThinFilm.PhirhozGeneratedCharacteristicThinFilm
pymcxray.FileFormat.Results.XrayIntensities.XrayIntensities
pymcxray.FileFormat.Results.XraySpectraRegionsEmitted.XraySpectraRegionsEmitted
pymcxray.FileFormat.Results.XraySpectraSpecimenEmittedDetected.XraySpectraSpecimenEmittedDetected
Analyze all simulations¶
This method is only needed for the task analyze
.
Often the method start by calling mcxray._Simulations.readResults()
to read all new results and add them in the hdf5 file.
The example below shows how-to open the hdf5 file in memory for somewhat fast analysis simulation. The file is read only at the beginning and stored in memory.
def analyze_results_hdf5(self): #pragma: no cover
self.readResults()
file_path = self.get_hdf5_file_path()
with h5py.File(file_path, 'r', driver='core') as hdf5_file:
hdf5_group = self.get_hdf5_group(hdf5_file)
logging.info(hdf5_group.name)
Todo
Document pymcxray.mcxray
Todo
Document pymcxray.SimulationsParameters
Todo
Document pymcxray.Simulation
Todo
Document pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic.PhirhozGeneratedCharacteristic
Todo
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/drix00/pymcxray/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
pymcxray could always use more documentation, whether as part of the official pymcxray docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/drix00/pymcxray/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up pymcxray for local development.
Fork the pymcxray repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pymcxray.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pymcxray $ cd pymcxray/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 pymcxray tests $ python setup.py test or py.test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check https://travis-ci.org/drix00/pymcxray/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Contributors¶
None yet. Why not be the first?
History¶
0.1.4 (2019-11-29)¶
- Add calculation of weight fractions for trace elements.
0.1.2 (2017-06-26)¶
- Add create multi-layers specimen.
- Add number of layers X, Y, and Z as parameters.
0.1.0 (2017-03-07)¶
- First release on PyPI.
ToDo¶
Todo
Add pypi installation for this project.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/installation.rst, line 13.)
Todo
Document pymcxray.mcxray
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 436.)
Todo
Document pymcxray.SimulationsParameters
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 437.)
Todo
Document pymcxray.Simulation
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 438.)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 439.)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 440.)
Todo
Document pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic.PhirhozGeneratedCharacteristic
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 441.)
Todo
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 442.)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 443.)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 444.)
Todo
Document pymcxray.FileFormat.Results.XraySpectraSpecimenEmittedDetected.XraySpectraSpecimenEmittedDetected
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 445.)
Todo
Add units.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/pymcxray/ElementProperties.py:docstring of pymcxray.ElementProperties.g_FermiEnergy, line 6.)
Todo
Add units.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/pymcxray/ElementProperties.py:docstring of pymcxray.ElementProperties.g_kFermi, line 6.)
Todo
Add units.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/pymcxray/ElementProperties.py:docstring of pymcxray.ElementProperties.g_plasmonEnergy, line 6.)
pymcxray¶
pymcxray package¶
Subpackages¶
pymcxray.FileFormat package¶
Subpackages¶
Read data map exported by MCXRay.
Read x-ray intensity distribution in XY exported from mcxray GUI.
Tests for the module DataMap.
-
class
pymcxray.FileFormat.Results.exported.test_DataMap.
TestDataMap
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module DataMap.
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.
Tests for the module XrayIntensityXY.
-
class
pymcxray.FileFormat.Results.exported.test_XrayIntensityXY.
TestXrayIntensityXY
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XrayIntensityXY.
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.
BaseResults
MCXRay beam parameters from results file.
MCXRay detector parameters from results file.
-
class
pymcxray.FileFormat.Results.DetectorParameters.
DetectorParameters
[source]¶ Bases:
object
-
angleBetweenDetectorSpecimenNormal_deg
¶
-
angleBetweenDetectorXAxis_deg
¶
-
beamDetectorDistance_cm
¶
-
crystalDensity_g_cm3
¶
-
crystalName
¶
-
crystalRadius_cm
¶
-
crystalThickness_cm
¶
-
deadLayerThickness_A
¶
-
diffusionLength_A
¶
-
noiseEdsDetector_eV
¶
-
solidAngle_deg
¶
-
surfaceQualityFactor
¶
-
takeoffAngleEffective_deg
¶
-
takeoffAngleNormalIncidence_deg
¶
-
thicknessAir_um
¶
-
thicknessAlWindow_um
¶
-
thicknessBeWindow_um
¶
-
thicknessH2O_um
¶
-
thicknessMoxtek_um
¶
-
thicknessOil_um
¶
-
thicknessTiWindow_um
¶
-
MCXRay dump results file.
Read electron exit results simulated with MCXRay.
MCXRay electron parameters results file.
-
class
pymcxray.FileFormat.Results.ElectronParameters.
ElectronParameters
[source]¶ Bases:
object
-
backscatteredRatio
¶
-
eRatio
¶
-
internalRatio
¶
-
meanAzimuthalAngleCollision_deg
¶
-
meanDistanceBetweenCollisions_A
¶
-
meanNumberCollisionPerElectrons
¶
-
meanPolarAngleCollision_deg
¶
-
numberSimulatedElectrons
¶
-
skirtRatio
¶
-
throughRatio
¶
-
Read ElectronResults MCXRay results file.
-
class
pymcxray.FileFormat.Results.ElectronResults.
ElectronResults
[source]¶ Bases:
pymcxray.FileFormat.Results.BaseResults.BaseResults
-
fieldNames
¶
-
fractionBackscatteredElectrons
¶
-
fractionInternalElectrons
¶
-
fractionSkirtedElectrons
¶
-
fractionTransmittedElectrons
¶
-
numberBackscatteredElectrons
¶
-
numberElectronCollisions
¶
-
numberInternalElectrons
¶
-
numberSimulatedElectrons
¶
-
numberSkirtedElectrons
¶
-
numberTransmittedElectrons
¶
-
Read MCXray electron trajectories results file.
-
class
pymcxray.FileFormat.Results.ElectronTrajectoriesResults.
Collision
[source]¶ Bases:
object
-
collisionType
¶
-
correctedX_A
¶
-
correctedY_A
¶
-
correctedZ_A
¶
-
energy_keV
¶
-
indexRegion
¶
-
x_A
¶
-
y_A
¶
-
z_A
¶
-
-
class
pymcxray.FileFormat.Results.ElectronTrajectoriesResults.
ElectronTrajectoriesResults
(filepath)[source]¶ Bases:
object
MCXRay element parameters result file.
MCXRay intersections results file.
MCXRay microscope parameter in results file.
MCXRay model parameters from results file.
-
class
pymcxray.FileFormat.Results.ModelParameters.
ModelParameters
[source]¶ Bases:
object
-
atomCollisionModel
¶
-
atomCollisionScreeningModel
¶
-
atomCrossSectionModel
¶
-
atomCrossSectionScreeningModel
¶
-
atomElectronRangeModel
¶
-
atomEnergyLossModel
¶
-
atomMeanIonizationPotentialModel
¶
-
atomScreeningModel
¶
-
bremsstrahlungCrossSectionModel
¶
-
characterisitcCrossSectionModel
¶
-
regionEnergyLossModel
¶
-
MCXRay phirhoz result file.
MCXRay result file phirhoz element.
Read PhirhozEmittedCharacteristic file from MCXRay.
Read mcxray phirhoz thin film emitted results.
MCXRay phirhoz generated result file.
Read PhirhozGeneratedCharacteristic file from MCXRay program.
Read mcxray phirhoz thin film generated results.
MCXRay phirhoz results file for a region.
MCXRay region parameters result file.
MCXRay result file region volume.
MCXRay simulation parameters results file.
-
class
pymcxray.FileFormat.Results.SimulationParameters.
SimulationParameters
[source]¶ Bases:
object
-
edsMaximumEnergy_keV
¶
-
generalizedWalk
¶
-
interpolationType
¶
-
maximumLiveTime_s
¶
-
numberChannels
¶
-
numberElectrons
¶
-
numberEnergyWindows
¶
-
numberLayersX
¶
-
numberLayersY
¶
-
numberLayersZ
¶
-
numberPhotons
¶
-
useLiveTime_s
¶
-
MCXRay spectra result file.
Read MCXRay spectra EDS results file.
MCXRay spectrum result file.
Read MCXRay EDS spectrm from results file.
MCXRay tags used in output files.
Xray intensities result file from MCXRay.
description
-
class
pymcxray.FileFormat.Results.XraySimulatedSpectraRegion.
XraySimulatedSpectraRegion
[source]¶ Bases:
pymcxray.FileFormat.Results.BaseResults.BaseResults
-
channelNumbers
¶
-
detectedIntensities
¶
-
eNetPeak
¶
-
energiesReference_keV
¶
-
energies_keV
¶
-
fieldNames
¶
-
peakToBackgrpound
¶
-
peakToBackgrpoundAverage
¶
-
simulatedIntensities
¶
-
description
Read MCXRay XraySpectraAtomEmittedDetectedLines file.
Read XraySpectraRegionEmitted mcxray result file.
Read all XraySpectraRegionsEmitted mcxray result files for all regions.
-
class
pymcxray.FileFormat.Results.XraySpectraRegionsEmitted.
XraySpectraRegionsEmitted
[source]¶ Bases:
pymcxray.FileFormat.Results.XraySpectraRegionEmitted.XraySpectraRegionEmitted
Read XraySpectraSpecimen MCXRay results file.
Read XraySpectraSpecimenEmittedDetected MCXRay results file.
Tests for the module BaseResults.
-
class
pymcxray.FileFormat.Results.test_BaseResults.
TestBaseResults
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module BaseResults.
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.
Tests for module BeamParameters.
-
class
pymcxray.FileFormat.Results.test_BeamParameters.
TestBeamParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module BeamParameters.
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.
Tests for module DetectorParameters.
-
class
pymcxray.FileFormat.Results.test_DetectorParameters.
TestDetectorParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module DetectorParameters.
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.
Tests for module Dump
-
class
pymcxray.FileFormat.Results.test_Dump.
TestDump
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Dump.
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.
Tests for module ElectronParameters.
-
class
pymcxray.FileFormat.Results.test_ElectronParameters.
TestElectronParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module ElectronParameters.
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.
Tests for the module XraySpectraSpecimen.
-
class
pymcxray.FileFormat.Results.test_ElectronResults.
TestElectronResults
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module ElectronResults.
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.
Tests for the module ElementParameters.
-
class
pymcxray.FileFormat.Results.test_ElementParameters.
TestElementParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module ElementParameters.
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.
Tests for module Intersections.
-
class
pymcxray.FileFormat.Results.test_Intersections.
TestIntersections
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Intersections.
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.
Tests for module MicroscopeParameters.
-
class
pymcxray.FileFormat.Results.test_MicroscopeParameters.
TestMicroscopeParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module MicroscopeParameters.
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.
ModelParameters
-
class
pymcxray.FileFormat.Results.test_ModelParameters.
TestModelParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module ModelParameters.
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.
Tests for the module Phirhoz.
-
class
pymcxray.FileFormat.Results.test_Phirhoz.
TestPhirhoz
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Phirhoz.
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.
Tests for the module PhirhozElement.
-
class
pymcxray.FileFormat.Results.test_PhirhozElement.
TestPhirhozElement
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozElement.
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.
Tests for the module PhirhozEmittedCharacteristic.
-
class
pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristic.
TestPhirhozEmittedCharacteristic
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozEmittedCharacteristic.
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.
Tests for module PhirhozEmittedCharacteristicThinFilm.
-
class
pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristicThinFilm.
TestPhirhozEmittedCharacteristicThinFilm
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozEmittedCharacteristicThinFilm.
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.
Tests for the module PhirhozGenerated.#
-
class
pymcxray.FileFormat.Results.test_PhirhozGenerated.
TestPhirhozGenerated
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module moduleName.
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.
Tests for the module PhirhozGeneratedCharacteristic.
-
class
pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristic.
TestPhirhozGeneratedCharacteristic
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozGeneratedCharacteristic.
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.
Tests for module PhirhozGeneratedCharacteristicThinFilm.
-
class
pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristicThinFilm.
TestPhirhozGeneratedCharacteristicThinFilm
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozGeneratedCharacteristicThinFilm.
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.
Tests for the module PhirhozRegion.
-
class
pymcxray.FileFormat.Results.test_PhirhozRegion.
TestPhirhozRegion
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module PhirhozRegion.
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.
Tests for the module RegionParameters.
-
class
pymcxray.FileFormat.Results.test_RegionParameters.
TestRegionParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module RegionParameters.
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.
Tests for the module RegionVolume.
-
class
pymcxray.FileFormat.Results.test_RegionVolume.
TestRegionVolume
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module RegionVolume.
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.
Tests for the module SimulationParameters.
-
class
pymcxray.FileFormat.Results.test_SimulationParameters.
TestSimulationParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module SimulationParameters.
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.
Tests for the module Spectra.
-
class
pymcxray.FileFormat.Results.test_Spectra.
TestSpectra
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Spectra.
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.
Tests for module SpectraEDS.
-
class
pymcxray.FileFormat.Results.test_SpectraEDS.
TestSpectraEDS
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module SpectraEDS.
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.
Tests for the module Spectrum
-
class
pymcxray.FileFormat.Results.test_Spectrum.
TestSpectrum
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Spectrum.
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.
Tests for the modules Tags.
-
class
pymcxray.FileFormat.Results.test_Tags.
TestTags
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Tags.
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.
Tests for the module XrayIntensities.
-
class
pymcxray.FileFormat.Results.test_XrayIntensities.
TestXrayIntensities
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XrayIntensities.
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.
description
-
class
pymcxray.FileFormat.Results.test_XraySimulatedSpectraRegion.
TestXraySimulatedSpectraRegion
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module moduleName.
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.
-
class
pymcxray.FileFormat.Results.test_XraySimulatedSpectraSpecimen.
TestXraySimulatedSpectraSpecimen
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XraySimulatedSpectraSpecimen.
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.
Tests for the module XraySpectraAtomEmittedDetectedLines.
-
class
pymcxray.FileFormat.Results.test_XraySpectraAtomEmittedDetectedLines.
TestXraySpectraAtomEmittedDetectedLines
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XraySpectraAtomEmittedDetectedLines.
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.
Tests for the module XraySpectraSpecimen.
-
class
pymcxray.FileFormat.Results.test_XraySpectraSpecimen.
TestXraySpectraSpecimen
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XraySpectraSpecimen.
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.
Tests for the module XraySpectraSpecimenEmittedDetected.
-
class
pymcxray.FileFormat.Results.test_XraySpectraSpecimenEmittedDetected.
TestXraySpectraSpecimenEmittedDetected
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module XraySpectraSpecimenEmittedDetected.
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.
Submodules¶
pymcxray.FileFormat.Element module¶
MCXRay element input file.
pymcxray.FileFormat.ExportedSpectrum module¶
Read and write exported spectrum from McXRay.
pymcxray.FileFormat.FileReaderWriterTools module¶
description
pymcxray.FileFormat.MCXRayModel module¶
Model type used in MCXRay.
-
class
pymcxray.FileFormat.MCXRayModel.
AtomCollisionModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BROWNING
= 1¶
-
TYPE_GAUVIN
= 2¶
-
TYPE_RUTHERFORD
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomCollisionScreeningModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_HENOC_MAURICE
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomCrossSectionModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BROWNING
= 0¶
-
TYPE_GAUVIN_DROUIN
= 1¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomCrossSectionScreeningModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_HENOC_MAURICE
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomElectronRangeModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_KANAYA_OKAYAMA
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomEnergyLossModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BETHE
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomMeanIonizationPotentialModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_JOY_LUO
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
AtomScreeningModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_HENOC_MAURICE
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
MassAbsorptionCoefficientModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_CHANTLER2005
= 3¶
-
TYPE_HEINRICH_DATA
= 1¶
-
TYPE_HEINRICH_PARAMETERIZATION
= 2¶
-
TYPE_HENKE
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
RegionEnergyLossModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BETHE
= 1¶
-
TYPE_BETHE_JOY_LUO
= 0¶
-
TYPE_BETHE_RELATIVISTIC
= 2¶
-
TYPE_JOY_LUO_KGAUVIN
= 3¶
-
TYPE_JOY_LUO_MONSEL
= 4¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
SampleEnergyLossModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BETHE_JOY_LUO
= 0¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
SpectrumInterpolationModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_COPY
= 0¶
-
TYPE_LINEAR
= 1¶
-
TYPE_LINEAR_DOUBLE
= 2¶
-
TYPE_SPLINE
= 3¶
-
TYPE_SPLINE_BATCH
= 4¶
-
TYPE_SPLINE_POINT
= 5¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
XRayCSBremsstrahlungModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BETHE_HEITLER
= 0¶
-
TYPE_DING
= 2¶
-
TYPE_GAUVIN
= 3¶
-
TYPE_KIRKPATRICK_WIEDMAN
= 1¶
-
-
class
pymcxray.FileFormat.MCXRayModel.
XRayCSCharacteristicModel
(currentModel=None)[source]¶ Bases:
pymcxray.FileFormat.MCXRayModel.MCXRayModel
-
TYPE_BOTE2009
= 1¶
-
TYPE_CASTANI1982
= 0¶
-
pymcxray.FileFormat.MicroscopeParameters module¶
MCXRay microscope parameters input file.
-
class
pymcxray.FileFormat.MicroscopeParameters.
MicroscopeParameters
[source]¶ Bases:
object
-
beamCurrent_A
¶
-
beamDiameter_A
¶
-
beamEnergy_keV
¶
-
beamPositionX_A
¶
-
beamPositionY_A
¶
-
beamStandardDeviation_A
¶
-
beamTilt_deg
¶
-
detectorAzimuthalAngle_deg
¶
-
detectorBFHigh_rad
¶
-
detectorBFLow_rad
¶
-
detectorChannelWidth_eV
¶
-
detectorCrystalAtomSymbol
¶
-
detectorCrystalDistance_cm
¶
-
detectorCrystalRadius_cm
¶
-
detectorCrystalThickness_cm
¶
-
detectorDFHigh_rad
¶
-
detectorDFLow_rad
¶
-
detectorDeadLayer_A
¶
-
detectorDiffusionLenght_A
¶
-
detectorHAADFHigh_rad
¶
-
detectorHAADFLow_rad
¶
-
detectorNoise_eV
¶
-
detectorPitch_deg
¶
-
detectorSurfaceQuality
¶
-
detectorTOA_deg
¶
-
time_s
¶
-
version
¶
-
pymcxray.FileFormat.Models module¶
MCXRay models file.
pymcxray.FileFormat.Region module¶
MCXRay region input file.
pymcxray.FileFormat.RegionDimensions module¶
MCXRay region dimensions input file.
-
class
pymcxray.FileFormat.RegionDimensions.
RegionDimensionsBox
(parameters=None)[source]¶ Bases:
pymcxray.FileFormat.RegionDimensions.RegionDimensions
-
maximumX
¶
-
maximumY
¶
-
maximumZ
¶
-
minimumX
¶
-
minimumY
¶
-
minimumZ
¶
-
-
class
pymcxray.FileFormat.RegionDimensions.
RegionDimensionsCylinder
(parameters=None)[source]¶ Bases:
pymcxray.FileFormat.RegionDimensions.RegionDimensionsSphere
-
directionX
¶
-
directionY
¶
-
directionZ
¶
-
length
¶
-
pymcxray.FileFormat.RegionType module¶
MCXRay region type input file.
pymcxray.FileFormat.ResultsParameters module¶
MCXRay ResultsParameters input file.
pymcxray.FileFormat.SimulationInputs module¶
MCXRay simulation inputs file.
pymcxray.FileFormat.SimulationParameters module¶
MCXRay simulation parameters input file.
-
class
pymcxray.FileFormat.SimulationParameters.
SimulationParameters
[source]¶ Bases:
object
-
baseFilename
¶
-
elasticCrossSectionScalingFactor
¶
-
energyChannelWidth_eV
¶
-
energyLossScalingFactor
¶
-
numberChannels
¶
-
numberElectrons
¶
-
numberFilmsX
¶
-
numberFilmsY
¶
-
numberFilmsZ
¶
-
numberPhotons
¶
-
numberWindows
¶
-
spectrumInterpolationModel
¶
-
version
¶
-
voxelSimplification
¶
-
pymcxray.FileFormat.SnrParameters module¶
MCXRay Snr input file.
pymcxray.FileFormat.Specimen module¶
MCXRay specimen input file.
pymcxray.FileFormat.Version module¶
MCXray version information.
pymcxray.FileFormat.testUtilities module¶
Utilities used for testing this package.
pymcxray.FileFormat.test_Element module¶
Tests for module Element.
-
class
pymcxray.FileFormat.test_Element.
TestElement
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Element.
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.FileFormat.test_ExportedSpectrum module¶
Tests for module ExportedSpectrum.
-
class
pymcxray.FileFormat.test_ExportedSpectrum.
TestExportedSpectrum
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module moduleName.
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.FileFormat.test_FileReaderWriterTools module¶
Tests for the module FileReaderWriterTools.
-
class
pymcxray.FileFormat.test_FileReaderWriterTools.
TestFileReaderWriterTools
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module FileReaderWriterTools.
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.FileFormat.test_MCXRayModel module¶
Tests for module MCXRayModel.
-
class
pymcxray.FileFormat.test_MCXRayModel.
TestMCXRayModel
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module MCXRayModel.
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.FileFormat.test_MicroscopeParameters module¶
pymcxray.FileFormat.test_Models module¶
pymcxray.FileFormat.test_Region module¶
Tests for module Region.
-
class
pymcxray.FileFormat.test_Region.
TestRegion
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module moduleName.
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.FileFormat.test_RegionDimensions module¶
Tests for module RegionDimensions.
-
class
pymcxray.FileFormat.test_RegionDimensions.
TestRegionDimensions
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module RegionDimensions.
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.
-
test_RegionDimensionsCylinder_createLineOldVersion
()[source]¶ Tests for class RegionDimensionsCylinder.
-
test_RegionDimensionsCylinder_createLineWithKey
()[source]¶ Tests for class RegionDimensionsCylinder.
-
test_RegionDimensionsCylinder_extractFromLineOldVersion
()[source]¶ Tests for class RegionDimensionsCylinder.
-
test_RegionDimensionsCylinder_extractFromLinesWithKey
()[source]¶ Tests for class RegionDimensionsCylinder.
-
test_RegionDimensionsSphere_extractFromLineOldVersion
()[source]¶ Tests for class RegionDimensionsSphere.
-
pymcxray.FileFormat.test_RegionType module¶
Test for module RegionType.
-
class
pymcxray.FileFormat.test_RegionType.
TestRegionType
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module RegionType.
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.FileFormat.test_ResultsParameters module¶
pymcxray.FileFormat.test_SimulationInputs module¶
pymcxray.FileFormat.test_SimulationParameters module¶
pymcxray.FileFormat.test_SnrParameters module¶
Tests for the module SnrParameters.
-
class
pymcxray.FileFormat.test_SnrParameters.
TestSnrParameters
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module SnrParameters.
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.FileFormat.test_Specimen module¶
pymcxray.FileFormat.test_Version module¶
Tests for module Version.
-
class
pymcxray.FileFormat.test_Version.
TestVersion
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
TestCase class for the module Version.
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.FileFormat.tests module¶
Module contents¶
pymcxray.serialization package¶
Submodules¶
pymcxray.serialization.SerializationH5py module¶
pymcxray.serialization.SerializationNumpy module¶
-
class
pymcxray.serialization.SerializationNumpy.
SerializationNumpy
(filename=None, verbose=True)[source]¶ Bases:
pymcxray.serialization._Serialization._Serialization
-
class
pymcxray.serialization.SerializationNumpy.
SerializationNumpyNPY
(filename=None, verbose=True)[source]¶ Bases:
pymcxray.serialization.SerializationNumpy.SerializationNumpy
-
class
pymcxray.serialization.SerializationNumpy.
SerializationNumpyNPZ
(filename=None, verbose=True)[source]¶ Bases:
pymcxray.serialization.SerializationNumpy.SerializationNumpy
-
class
pymcxray.serialization.SerializationNumpy.
SerializationNumpyTxt
(filename=None, verbose=True)[source]¶ Bases:
pymcxray.serialization.SerializationNumpy.SerializationNumpy
-
class
pymcxray.serialization.SerializationNumpy.
SerializationNumpyTxtGz
(filename=None, verbose=True)[source]¶ Bases:
pymcxray.serialization.SerializationNumpy.SerializationNumpyTxt
pymcxray.serialization.SerializationPickle module¶
pymcxray.serialization.test_Serialization module¶
pymcxray.serialization.test_SerializationH5py module¶
-
class
pymcxray.serialization.test_SerializationH5py.
TestSerializationH5py
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
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.serialization.test_SerializationNumpy module¶
-
class
pymcxray.serialization.test_SerializationNumpy.
TestSerializationNumpy
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
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.serialization.test_SerializationPickle module¶
pymcxray.serialization.tests module¶
Regression testing for the project.
Module contents¶
pymcxray.tests package¶
Submodules¶
pymcxray.tests.test_pymcxray module¶
Tests for pymcxray module.
Module contents¶
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