Welcome to pymcxray’s documentation!

Contents:

pymcxray

https://img.shields.io/pypi/v/pymcxray.svg https://img.shields.io/travis/drix00/pymcxray.svg Documentation Status Updates

Python scripts for using mcxray software

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:

  1. generate
  2. check
  3. read
  4. 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

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

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.Simulation

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.

  1. Fork the pymcxray repo on GitHub.

  2. Clone your fork locally:

    $ git clone git@github.com:your_name_here/pymcxray.git
    
  3. 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
    
  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  5. 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.

  6. 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
    
  7. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.
  2. 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.
  3. 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.

Tips

To run a subset of tests:

$ python -m unittest tests.test_pymcxray

Credits

Development Lead

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.)

(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.)

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pymcxray/checkouts/latest/docs/usage.rst, line 441.)

(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.)

(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
pymcxray.FileFormat.Results package
Subpackages
pymcxray.FileFormat.Results.exported package
Submodules
pymcxray.FileFormat.Results.exported.DataMap module

Read data map exported by MCXRay.

class pymcxray.FileFormat.Results.exported.DataMap.DataMap(filepath)[source]

Bases: object

imageName
pixels
read()[source]
saveImage(imageFilepath=None)[source]
showImage()[source]
size
pymcxray.FileFormat.Results.exported.DataMap.run()[source]
pymcxray.FileFormat.Results.exported.XrayIntensityXY module

Read x-ray intensity distribution in XY exported from mcxray GUI.

class pymcxray.FileFormat.Results.exported.XrayIntensityXY.XrayIntensityXY[source]

Bases: object

readData(filepath)[source]
pymcxray.FileFormat.Results.exported.test_DataMap module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_init()[source]

Tests for method init.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.exported.test_XrayIntensityXY module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testOpenFile()[source]

Test if the test data file can be open.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

pymcxray.FileFormat.Results.exported.tests module
Module contents
Submodules
pymcxray.FileFormat.Results.BaseResults module

BaseResults

class pymcxray.FileFormat.Results.BaseResults.BaseResults(path='', basename='MCXRay')[source]

Bases: object

basename
filepath
path
pymcxray.FileFormat.Results.BeamParameters module

MCXRay beam parameters from results file.

class pymcxray.FileFormat.Results.BeamParameters.BeamParameters[source]

Bases: object

acquisitionTime_s
current_A
diameter90_A
gaussianMean
gaussianSigma
incidentEnergy_keV
readFromLines(lines)[source]
tiltAngle_deg
pymcxray.FileFormat.Results.DetectorParameters module

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
readFromLines(lines)[source]
solidAngle_deg
surfaceQualityFactor
takeoffAngleEffective_deg
takeoffAngleNormalIncidence_deg
thicknessAir_um
thicknessAlWindow_um
thicknessBeWindow_um
thicknessH2O_um
thicknessMoxtek_um
thicknessOil_um
thicknessTiWindow_um
pymcxray.FileFormat.Results.Dump module

MCXRay dump results file.

class pymcxray.FileFormat.Results.Dump.Dump[source]

Bases: object

read(filepath)[source]
pymcxray.FileFormat.Results.ElectronExistResults module

Read electron exit results simulated with MCXRay.

class pymcxray.FileFormat.Results.ElectronExistResults.ElectronDetector[source]

Bases: object

azimuthalAngleRange_deg
detectElectrons(data)[source]
energyRange_keV
maximumAzimuthalAngle_deg
maximumEnergy_keV
maximumPolarAngle_deg
minimumAzimuthalAngle_deg
minimumEnergy_keV
minimumPolarAngle_deg
polarAngleRange_deg
class pymcxray.FileFormat.Results.ElectronExistResults.ElectronExistResults(*args, **kargs)[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

data
getEnergyDistribution(numberBins=10)[source]
numberData
read()[source]
pymcxray.FileFormat.Results.ElectronParameters module

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
readFromLines(lines)[source]
skirtRatio
throughRatio
pymcxray.FileFormat.Results.ElectronResults module

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()[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.ElectronTrajectoriesResults module

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

drawXY(title='', corrected=False, x_limit=None, y_limit=None)[source]
drawXZ(title='', corrected=False, theta_deg=0.0, colorType='colorTrajectoryType', trajectoryIndexes=None, x_limit=None, y_limit=None)[source]
drawYZ(title='', corrected=False, x_limit=None, y_limit=None)[source]
getElectronGunPositions_nm()[source]
read(filepath)[source]
write_hdf5(hdf5_group)[source]
class pymcxray.FileFormat.Results.ElectronTrajectoriesResults.Trajectory[source]

Bases: object

addCollision(collision)[source]
collisions
index
trajectoryType
pymcxray.FileFormat.Results.ElectronTrajectoriesResults.run()[source]
pymcxray.FileFormat.Results.ElectronTrajectoriesResults.runAuCThinFilm()[source]
pymcxray.FileFormat.Results.ElectronTrajectoriesResults.runFogging()[source]
pymcxray.FileFormat.Results.ElementParameters module

MCXRay element parameters result file.

class pymcxray.FileFormat.Results.ElementParameters.ElementParameters[source]

Bases: object

pymcxray.FileFormat.Results.Intersections module

MCXRay intersections results file.

class pymcxray.FileFormat.Results.Intersections.Intersections[source]

Bases: object

extractFromLines(lines)[source]
pymcxray.FileFormat.Results.MicroscopeParameters module

MCXRay microscope parameter in results file.

class pymcxray.FileFormat.Results.MicroscopeParameters.MicroscopeParameters[source]

Bases: object

beamParameters
detectorParameters
readFromLines(lines)[source]
pymcxray.FileFormat.Results.ModelParameters module

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
readFromLines(lines)[source]
regionEnergyLossModel
pymcxray.FileFormat.Results.Phirhoz module

MCXRay phirhoz result file.

class pymcxray.FileFormat.Results.Phirhoz.Phirhoz(symbol, shell)[source]

Bases: object

depths_A
intensity
readFromLines(lines)[source]
shell
symbol
values
pymcxray.FileFormat.Results.PhirhozElement module

MCXRay result file phirhoz element.

class pymcxray.FileFormat.Results.PhirhozElement.PhirhozElement[source]

Bases: object

isIonizationShell_K
isIonizationShell_L
isIonizationShell_M
readFromLine(line)[source]
symbol
weightFraction
pymcxray.FileFormat.Results.PhirhozEmittedCharacteristic module

Read PhirhozEmittedCharacteristic file from MCXRay.

class pymcxray.FileFormat.Results.PhirhozEmittedCharacteristic.PhirhozEmittedCharacteristic[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

depth_A
depth_nm
fieldNames
phirhozs
read(regionID=0)[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.PhirhozEmittedCharacteristicThinFilm module

Read mcxray phirhoz thin film emitted results.

class pymcxray.FileFormat.Results.PhirhozEmittedCharacteristicThinFilm.PhirhozEmittedCharacteristicThinFilm[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

fieldNames
getIntensity(regionID, atomicSymbol, xrayLine)[source]
intensities
numberRegions
read()[source]
pymcxray.FileFormat.Results.PhirhozGenerated module

MCXRay phirhoz generated result file.

class pymcxray.FileFormat.Results.PhirhozGenerated.PhirhozGenerated[source]

Bases: object

electronParameters
getCharacteristicPhiRhoZ(regionID)[source]
microscopeParameters
modelParameters
numberRegions
read(filepath)[source]
readElectron(lines)[source]
readMicroscope(lines)[source]
readRegions(lines)[source]
readSimulationParameters(lines)[source]
readSolidSimulationModels(lines)[source]
simulationParameters
pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic module

Read PhirhozGeneratedCharacteristic file from MCXRay program.

class pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristic.PhirhozGeneratedCharacteristic[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

depth_A
depth_nm
fieldNames
phirhozs
read(regionID=0)[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristicThinFilm module

Read mcxray phirhoz thin film generated results.

class pymcxray.FileFormat.Results.PhirhozGeneratedCharacteristicThinFilm.PhirhozGeneratedCharacteristicThinFilm[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

fieldNames
getIntensity(regionID, atomicSymbol, xrayLine)[source]
get_subshells()[source]
get_symbols()[source]
intensities
numberRegions
read()[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.PhirhozRegion module

MCXRay phirhoz results file for a region.

class pymcxray.FileFormat.Results.PhirhozRegion.PhirhozRegion(numberEnergyWindows, numberLayersZ)[source]

Bases: object

readBackgroundPhirhozs(lines)[source]
readCharacteristicPhirhozs(lines)[source]
readElements(lines)[source]
readFromLines(lines)[source]
readPhirhozDistributions(lines)[source]
readRegionVolume(lines)[source]
regionID
pymcxray.FileFormat.Results.RegionParameters module

MCXRay region parameters result file.

class pymcxray.FileFormat.Results.RegionParameters.RegionParameters[source]

Bases: object

elements
layerThickness_A
numberElements
regionID
pymcxray.FileFormat.Results.RegionVolume module

MCXRay result file region volume.

class pymcxray.FileFormat.Results.RegionVolume.RegionVolume[source]

Bases: object

readFromLines(lines)[source]
regionID
pymcxray.FileFormat.Results.SimulationParameters module

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
readFromLines(lines)[source]
useLiveTime_s
pymcxray.FileFormat.Results.Spectra module

MCXRay spectra result file.

class pymcxray.FileFormat.Results.Spectra.Spectra[source]

Bases: object

getElementSpectra()[source]
getElementSpectrum(regionID, elementName)[source]
getRegionParameters(regionID)[source]
getRegionSpectrum(regionID)[source]
getSpecimenSpectrum()[source]
numberRegions
read(filepath)[source]
readRegion(lines)[source]
readRegions(lines)[source]
readSpecimen(lines)[source]
pymcxray.FileFormat.Results.SpectraEDS module

Read MCXRay spectra EDS results file.

class pymcxray.FileFormat.Results.SpectraEDS.SpectraEDS[source]

Bases: object

characteristicProbability
elements
numberCharateristicPeaks
numberElements
numberSimulatedPhotons
readFileObject(inputFile)[source]
readFilepath(filepath)[source]
readPartialSpectraReferenceSection(lines)[source]
readRegionSpectraSection(lines)[source]
readTestInputSection(lines)[source]
regionID
pymcxray.FileFormat.Results.SpectraEDS.runExample()[source]
pymcxray.FileFormat.Results.Spectrum module

MCXRay spectrum result file.

class pymcxray.FileFormat.Results.Spectrum.Spectrum[source]

Bases: object

backgroundIntensities
characteristicIntensities
energies_keV
intensities
pymcxray.FileFormat.Results.SpectrumEDS module

Read MCXRay EDS spectrm from results file.

class pymcxray.FileFormat.Results.SpectrumEDS.SpectrumEDS(lines=None)[source]

Bases: object

channels
countsList
enegies_keV
readLines(lines)[source]
pymcxray.FileFormat.Results.Tags module

MCXRay tags used in output files.

exception pymcxray.FileFormat.Results.Tags.TagNotFoundError[source]

Bases: ValueError

pymcxray.FileFormat.Results.Tags.findAllTag(tag, lines, contains=None)[source]
pymcxray.FileFormat.Results.Tags.findTag(tag, lines)[source]
pymcxray.FileFormat.Results.XrayIntensities module

Xray intensities result file from MCXRay.

class pymcxray.FileFormat.Results.XrayIntensities.XrayIntensities[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

fieldNames
getAtomicNumberLineEnergySets()[source]
getDetectedIntensity(atomicNumber, xrayLine)[source]
getIntensity(data_type, region_id, atomic_number, xray_line)[source]
getIntensityEmitted(atomicNumber, xrayLine, total=True)[source]
getIntensityEmittedDetected(atomicNumber, xrayLine, total=True)[source]
getIntensityGenerated(atomicNumber, xraySubshell, total=False)[source]
getIntensityGeneratedDetected(atomicNumber, xraySubshell)[source]
get_result_types()[source]
get_xray_lines()[source]
intensities
numberIntensities
read()[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.XraySimulatedSpectraRegion module

description

class pymcxray.FileFormat.Results.XraySimulatedSpectraRegion.XraySimulatedSpectraRegion[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

channelNumbers
detectedIntensities
eNetPeak
energiesReference_keV
energies_keV
fieldNames
peakToBackgrpound
peakToBackgrpoundAverage
read(regionID=0)[source]
simulatedIntensities
pymcxray.FileFormat.Results.XraySimulatedSpectraSpecimen module

description

class pymcxray.FileFormat.Results.XraySimulatedSpectraSpecimen.XraySimulatedSpectraSpecimen[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

energies_keV
fieldNames
read()[source]
totals
pymcxray.FileFormat.Results.XraySpectraAtomEmittedDetectedLines module

Read MCXRay XraySpectraAtomEmittedDetectedLines file.

class pymcxray.FileFormat.Results.XraySpectraAtomEmittedDetectedLines.XraySpectraAtomEmittedDetectedLines[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

characteristics
energies_keV
fieldNames
read(regionID)[source]
pymcxray.FileFormat.Results.XraySpectraRegionEmitted module

Read XraySpectraRegionEmitted mcxray result file.

class pymcxray.FileFormat.Results.XraySpectraRegionEmitted.XraySpectraRegionEmitted[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

bremsstrahlungValue_1_ekeVsr(energy_keV)[source]
bremsstrahlung_1_ekeVsr
characteristicValue_1_ekeVsr(energy_keV)[source]
characteristic_1_ekeVsr
energies_keV
fieldnames
read(regionID=0)[source]
totalValue_1_ekeVsr(energy_keV)[source]
total_1_ekeVsr
pymcxray.FileFormat.Results.XraySpectraRegionEmitted.run()[source]
pymcxray.FileFormat.Results.XraySpectraRegionsEmitted module

Read all XraySpectraRegionsEmitted mcxray result files for all regions.

class pymcxray.FileFormat.Results.XraySpectraRegionsEmitted.XraySpectraRegionsEmitted[source]

Bases: pymcxray.FileFormat.Results.XraySpectraRegionEmitted.XraySpectraRegionEmitted

read()[source]
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.XraySpectraRegionsEmitted.run()[source]
pymcxray.FileFormat.Results.XraySpectraSpecimen module

Read XraySpectraSpecimen MCXRay results file.

class pymcxray.FileFormat.Results.XraySpectraSpecimen.XraySpectraSpecimen[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

backgrounds
characteristics
energies_keV
fieldNames
read()[source]
totals
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.XraySpectraSpecimenEmittedDetected module

Read XraySpectraSpecimenEmittedDetected MCXRay results file.

class pymcxray.FileFormat.Results.XraySpectraSpecimenEmittedDetected.XraySpectraSpecimenEmittedDetected[source]

Bases: pymcxray.FileFormat.Results.BaseResults.BaseResults

backgrounds
characteristics
energies_keV
fieldNames
read()[source]
totals
write_hdf5(hdf5_group)[source]
pymcxray.FileFormat.Results.test_BaseResults module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_basename()[source]

Tests for method basename.

test_init()[source]

Tests for method init.

test_path()[source]

Tests for method path.

pymcxray.FileFormat.Results.test_BeamParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_DetectorParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_Dump module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_ElectronExistResults module
pymcxray.FileFormat.Results.test_ElectronParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_ElectronParameters.getLinesAndReference()[source]
pymcxray.FileFormat.Results.test_ElectronResults module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_ElementParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

pymcxray.FileFormat.Results.test_Intersections module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_extractFromLines()[source]

Tests for method extractFromLines.

pymcxray.FileFormat.Results.test_MicroscopeParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_MicroscopeParameters.getLinesAndReference()[source]
pymcxray.FileFormat.Results.test_ModelParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_ModelParameters.getLinesAndReference()[source]
pymcxray.FileFormat.Results.test_Phirhoz module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_Phirhoz.getLinesAndReference(path)[source]
pymcxray.FileFormat.Results.test_PhirhozElement module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLine()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_PhirhozElement.getLineAndReference()[source]
pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristic module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_PhirhozEmittedCharacteristicThinFilm module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_getIntensity()[source]

Tests for method getIntensity.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_PhirhozGenerated module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristic module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_PhirhozGeneratedCharacteristicThinFilm module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_getIntensity()[source]

Tests for method getIntensity.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_PhirhozRegion module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_PhirhozRegion.getLinesAndReference(path)[source]
pymcxray.FileFormat.Results.test_RegionParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

pymcxray.FileFormat.Results.test_RegionVolume module

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.

NOtest_readFromLines()[source]

Tests for method readFromLines.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

pymcxray.FileFormat.Results.test_RegionVolume.getLinesAndReference()[source]
pymcxray.FileFormat.Results.test_SimulationParameters module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_readFromLines()[source]

Tests for method readFromLines.

pymcxray.FileFormat.Results.test_SimulationParameters.getLinesAndReference()[source]
pymcxray.FileFormat.Results.test_Spectra module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test__extractElementHeader()[source]

Tests for method _extractElementHeader.

test__extractRegionHeader()[source]

Tests for method _extractRegionHeader.

test_read()[source]

Tests for method read.

test_readRegion()[source]

Tests for method readRegion.

test_readSpecimen()[source]

Tests for method readSpecimen.

pymcxray.FileFormat.Results.test_SpectraEDS module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_FindTestData()[source]

Tests for method FindTestData.

test__extractTotalCounts()[source]

Tests for method _extractTotalCounts.

test__isPartialSpectraReferenceSection()[source]

Tests for method _isTestInputSection.

test__isRegionSpectraSection()[source]

Tests for method _isRegionSpectraSection.

test__isTestInputSection()[source]

Tests for method _isTestInputSection.

test_readPartialSpectraReferenceSection()[source]

Tests for method readTestInputSection.

test_readRegionSpectraSection()[source]

Tests for method readRegionSpectraSection.

test_readTestInputSection()[source]

Tests for method readTestInputSection.

pymcxray.FileFormat.Results.test_Spectrum module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

pymcxray.FileFormat.Results.test_Tags module

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.

getLines()[source]
setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_findTag()[source]

Tests for method findTag.

pymcxray.FileFormat.Results.test_XrayIntensities module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_XraySimulatedSpectraRegion module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_XraySimulatedSpectraSpecimen module
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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_XraySpectraAtomEmittedDetectedLines module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_XraySpectraRegionEmitted module
pymcxray.FileFormat.Results.test_XraySpectraRegionsEmitted module
pymcxray.FileFormat.Results.test_XraySpectraSpecimen module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.test_XraySpectraSpecimenEmittedDetected module

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

pymcxray.FileFormat.Results.tests module
Module contents
Submodules
pymcxray.FileFormat.Element module

MCXRay element input file.

class pymcxray.FileFormat.Element.Element(atomicNumber=0, massFraction=1.0)[source]

Bases: object

atomicNumber
createLineOldVersion()[source]
createLinesWithKey()[source]
extractFromLineOldVersion(line)[source]
extractFromLinesWithKey(lines)[source]
massFraction
name
pymcxray.FileFormat.ExportedSpectrum module

Read and write exported spectrum from McXRay.

class pymcxray.FileFormat.ExportedSpectrum.ExportedSpectrum[source]

Bases: object

getData()[source]
getSpectrumType()[source]
read(filepath)[source]
pymcxray.FileFormat.FileReaderWriterTools module

description

pymcxray.FileFormat.FileReaderWriterTools.reduceAfterDot(value)[source]
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.MCXRayModel(currentModel=None)[source]

Bases: object

getModel()[source]
setModel(modelType)[source]
setModelFromString(text)[source]
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
defaultValues()[source]
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
read(filepath)[source]
time_s
version
write(filepath)[source]
pymcxray.FileFormat.Models module

MCXRay models file.

class pymcxray.FileFormat.Models.Models[source]

Bases: object

getModelList()[source]
modelAtomCollision
modelAtomCrossSection
modelAtomMac
modelSampleEnergyLoss
modelXrayBremsstrahlung
modelXrayCharacteristic
read(filepath)[source]
version
write(filepath)[source]
pymcxray.FileFormat.Region module

MCXRay region input file.

class pymcxray.FileFormat.Region.Region[source]

Bases: object

clear()[source]
createLinesWithVersion()[source]
createLinesWithoutVersion()[source]
extractFromLinesWithVersion(lines)[source]
extractFromLinesWithoutVersion(lines)[source]
pymcxray.FileFormat.RegionDimensions module

MCXRay region dimensions input file.

class pymcxray.FileFormat.RegionDimensions.RegionDimensions(parameters=None)[source]

Bases: object

createLineOldVersion()[source]
createLineWithKey()[source]
extractFromLineOldVersion(line)[source]
extractFromLinesWithKey(line)[source]
getLineFormat()[source]
class pymcxray.FileFormat.RegionDimensions.RegionDimensionsBox(parameters=None)[source]

Bases: pymcxray.FileFormat.RegionDimensions.RegionDimensions

getLineFormat()[source]
maximumX
maximumY
maximumZ
minimumX
minimumY
minimumZ
class pymcxray.FileFormat.RegionDimensions.RegionDimensionsCylinder(parameters=None)[source]

Bases: pymcxray.FileFormat.RegionDimensions.RegionDimensionsSphere

directionX
directionY
directionZ
getLineFormat()[source]
length
class pymcxray.FileFormat.RegionDimensions.RegionDimensionsSphere(parameters=None)[source]

Bases: pymcxray.FileFormat.RegionDimensions.RegionDimensions

getLineFormat()[source]
positionX
positionY
positionZ
radius
pymcxray.FileFormat.RegionDimensions.createRegionDimensions(regionType)[source]
pymcxray.FileFormat.RegionType module

MCXRay region type input file.

pymcxray.FileFormat.ResultsParameters module

MCXRay ResultsParameters input file.

class pymcxray.FileFormat.ResultsParameters.ResultsParameters[source]

Bases: object

defaultValues()[source]
isComputeXrayBremsstrahlung
isComputeXrayCharacteristic
isComputeXrayPhirhoz
isComputeXraySimulatedSpectrum
read(filepath)[source]
version
write(filepath)[source]
pymcxray.FileFormat.SimulationInputs module

MCXRay simulation inputs file.

class pymcxray.FileFormat.SimulationInputs.SimulationInputs[source]

Bases: object

getExtension(key)[source]
mapFilename
microsopeFilename
modelFilename
read(filepath)[source]
resultParametersFilename
simulationParametersFilename
snrFilename
specimenFilename
title
version
write(filepath)[source]
pymcxray.FileFormat.SimulationParameters module

MCXRay simulation parameters input file.

class pymcxray.FileFormat.SimulationParameters.SimulationParameters[source]

Bases: object

baseFilename
defaultValues()[source]
elasticCrossSectionScalingFactor
energyChannelWidth_eV
energyLossScalingFactor
numberChannels
numberElectrons
numberFilmsX
numberFilmsY
numberFilmsZ
numberPhotons
numberWindows
read(filepath)[source]
spectrumInterpolationModel
version
voxelSimplification
write(filepath)[source]
pymcxray.FileFormat.SnrParameters module

MCXRay Snr input file.

class pymcxray.FileFormat.SnrParameters.SnrParameters[source]

Bases: object

backgroundEnergyWindowsSize
defaultValues()[source]
energyEnd_keV
energyStart_keV
numberEnergySteps
read(filepath)[source]
snrType
spectrumEnergyWindowsSize
write(filepath)[source]
pymcxray.FileFormat.Specimen module

MCXRay specimen input file.

class pymcxray.FileFormat.Specimen.Specimen[source]

Bases: object

clear()[source]
name
numberRegions
read(filepath)[source]
regions
version
write(filepath)[source]
pymcxray.FileFormat.Version module

MCXray version information.

class pymcxray.FileFormat.Version.Version(major, minor, revision)[source]

Bases: object

fromString(versionString)[source]
key = 'Version'
major
minor
readFromFile(filepath)[source]
revision
toString()[source]
writeLine(outputFile)[source]
pymcxray.FileFormat.testUtilities module

Utilities used for testing this package.

pymcxray.FileFormat.testUtilities.createTempDataPath(path)[source]
pymcxray.FileFormat.testUtilities.getSimulationTitles()[source]
pymcxray.FileFormat.testUtilities.removeTempDataPath(path)[source]
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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_createLineOldVersion()[source]

Tests for method createLineOldVersion.

test_createLineWithKey()[source]

Tests for method createLineOldVersion.

test_extractFromLineOldVersion()[source]

Tests for method extractFromLineOldVersion.

test_extractFromLineWithKey()[source]

Tests for method extractFromLinesWithKey.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_read()[source]

Tests for method read.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test__reduceAfterDot()[source]

Tests for method reduceAfterDot.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_MCXRayModel()[source]

Tests for method MCXRayModel.

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.

getTestRegionLinesWithVersion(title, userMassDensity=True)[source]
getTestRegionLinesWithoutVersion(title, userMassDensity=True)[source]
setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_createLinesWithVersion()[source]

Tests for method createLinesWithVersion.

test_createLinesWithoutVersion()[source]

Tests for method createLinesWithoutVersion.

test_extractFromLinesWithVersion()[source]

Tests for method read.

test_extractFromLinesWithoutVersion()[source]

Tests for method read.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_RegionDimensionsBox_createLineOldVersion()[source]

Tests for class RegionDimensionsBox.

test_RegionDimensionsBox_createLineWithKey()[source]

Tests for class RegionDimensionsBox.

test_RegionDimensionsBox_extractFromLineOldVersion()[source]

Tests for class RegionDimensionsBox.

test_RegionDimensionsBox_extractFromLinesWithKey()[source]

Tests for class RegionDimensionsBox.

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_createLineOldVersion()[source]

Tests for class RegionDimensionsSphere.

test_RegionDimensionsSphere_createLineWithKey()[source]

Tests for class RegionDimensionsSphere.

test_RegionDimensionsSphere_extractFromLineOldVersion()[source]

Tests for class RegionDimensionsSphere.

test_RegionDimensionsSphere_extractFromLinesWithKey()[source]

Tests for class RegionDimensionsSphere.

test_createRegionDimensions()[source]

Tests for method createRegionDimensions.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_Constants()[source]

Tests for method Constants.

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.

getSnrParametersReference(title)[source]
setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test__createKeys()[source]

Tests for method _createKeys.

test_read()[source]

Tests for method read.

test_write()[source]

Tests for method write.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_VersionConstants()[source]

Tests for method VersionConstants.

test_comparison()[source]

Test comparison operation on Version class.

test_fromString()[source]

Tests for method fromString.

test_readFromFile()[source]

Tests for method readFromFile.

test_readFromFile_BadFile()[source]

Tests for method readFromFile.

test_toString()[source]

Tests for method toString.

test_writeLine()[source]

Tests for method writeLine.

pymcxray.FileFormat.tests module
Module contents
pymcxray.serialization package
Submodules
pymcxray.serialization.SerializationH5py module
class pymcxray.serialization.SerializationH5py.SerializationNumpy(filename=None, verbose=True)[source]

Bases: pymcxray.serialization._Serialization._Serialization

load()[source]
save(serializedData)[source]
pymcxray.serialization.SerializationNumpy module
class pymcxray.serialization.SerializationNumpy.SerializationNumpy(filename=None, verbose=True)[source]

Bases: pymcxray.serialization._Serialization._Serialization

load()[source]
save(serializedData)[source]
class pymcxray.serialization.SerializationNumpy.SerializationNumpyNPY(filename=None, verbose=True)[source]

Bases: pymcxray.serialization.SerializationNumpy.SerializationNumpy

load()[source]
save(data)[source]
class pymcxray.serialization.SerializationNumpy.SerializationNumpyNPZ(filename=None, verbose=True)[source]

Bases: pymcxray.serialization.SerializationNumpy.SerializationNumpy

load()[source]
save(data)[source]
class pymcxray.serialization.SerializationNumpy.SerializationNumpyTxt(filename=None, verbose=True)[source]

Bases: pymcxray.serialization.SerializationNumpy.SerializationNumpy

load()[source]
save(data)[source]
class pymcxray.serialization.SerializationNumpy.SerializationNumpyTxtGz(filename=None, verbose=True)[source]

Bases: pymcxray.serialization.SerializationNumpy.SerializationNumpyTxt

pymcxray.serialization.SerializationPickle module
class pymcxray.serialization.SerializationPickle.SerializationPickle(filename=None, verbose=True)[source]

Bases: pymcxray.serialization._Serialization._Serialization

KEY_FILE_VERSION = 'fileVersion'
KEY_SERIALIZED_DATA = 'serializedData'
load()[source]
save(serializedData)[source]
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.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

testSkeleton()[source]
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.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

testSkeleton()[source]
test_loadSaveSerializationNumpy()[source]
test_loadSaveSerializationNumpyNPY()[source]
test_loadSaveSerializationNumpyNPZ()[source]
test_loadSaveSerializationNumpyTxt()[source]
test_loadSaveSerializationNumpyTxtGz()[source]
pymcxray.serialization.test_SerializationPickle module
class pymcxray.serialization.test_SerializationPickle.TestSerialization(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.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

testSkeleton()[source]
test_loadSave()[source]
test_version()[source]
pymcxray.serialization.tests module

Regression testing for the project.

Module contents
pymcxray.tests package
Submodules
pymcxray.tests.test_pymcxray module
test_pymcxray

Tests for pymcxray module.

class pymcxray.tests.test_pymcxray.TestPymcxray(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.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_000_something()[source]
Module contents

Submodules

pymcxray.AnalyzeNumberBackgroundWindows module

Analyze the number of background windows on the x-ray spectrum.

class pymcxray.AnalyzeNumberBackgroundWindows.AnalyzeNumberBackgroundWindows[source]

Bases: object

plotData()[source]
plotDifference()[source]
readData()[source]
pymcxray.AnalyzeNumberBackgroundWindows.run()[source]

pymcxray.AtomData module

MCXRay atom data.

pymcxray.AtomData.getAtomSymbol(atomic_number)[source]
pymcxray.AtomData.getAtomicNumber(symbol)[source]
pymcxray.AtomData.getIonizationEnergy_keV(shell, element)[source]
pymcxray.AtomData.getMassDensity_g_cm3(symbol)[source]
pymcxray.AtomData.getShellList()[source]
pymcxray.AtomData.getXRayEnergy_keV(line, element)[source]
pymcxray.AtomData.get_atomic_weight_g_mol(atomic_number)[source]
pymcxray.AtomData.run()[source]

pymcxray.BatchFile module

MCXRay batch file creator.

class pymcxray.BatchFile.BatchFile(name, numberFiles=1)[source]

Bases: object

addSimulationName(simulationFilename)[source]
removePreviousFiles(path)[source]
write(path)[source]

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
addSimulationName(simulationFilename)[source]

Add a simulation in the simulation list.

Parameters:simulationFilename (str) – File path of the simulation added
write(path)[source]

Write the batch files for all simulations in the simulation list.

Parameters:path (str) – Path where the batch files are written.

pymcxray.ComparisonModels module

Comparison of the models used by MCXray.

class pymcxray.ComparisonModels.ComparisonModels(dataPath)[source]

Bases: object

graphicsEnergyLoss()[source]
graphicsIonizationCrossSection()[source]
graphicsXrayCrossSectionBremstrahlung()[source]
graphicsXrayMassAbsorptionCoefficient()[source]
pymcxray.ComparisonModels.runVersion1_2_3()[source]
pymcxray.ComparisonModels.runVersion1_4_0()[source]
pymcxray.ComparisonModels.runVersion1_4_1()[source]

pymcxray.DebugSimulatedSpectrum module

Debug the simulated spectrum implementation in mcxray.

class pymcxray.DebugSimulatedSpectrum.DebugSimulatedSpectrum[source]

Bases: object

runRegion()[source]
runSpecimen()[source]
pymcxray.DebugSimulatedSpectrum.run()[source]

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.getAtomicMass_g_mol(atomicNumber)[source]
pymcxray.ElementProperties.getAtomicNumber(atomicNumber=None, name=None, symbol=None)[source]
pymcxray.ElementProperties.getAtomicNumberByName(name)[source]
pymcxray.ElementProperties.getAtomicNumberBySymbol(symbol)[source]
pymcxray.ElementProperties.getFermiEnergy_eV(atomicNumber)[source]
pymcxray.ElementProperties.getKFermi_eV(atomicNumber)[source]
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.ElementProperties.getMassDensity_g_cm3(atomicNumber)[source]
pymcxray.ElementProperties.getMeanIonizationEnergy_eV(atomic_number)[source]

Get the mean ionization potential from the atomic number.

In \(eV\).

Parameters:atomic_number (int) – Atomic number
pymcxray.ElementProperties.getName(atomicNumber)[source]
pymcxray.ElementProperties.getPlasmonEnergy_eV(atomicNumber)[source]
pymcxray.ElementProperties.getSymbol(atomicNumber)[source]
pymcxray.ElementProperties.run()[source]
pymcxray.ElementProperties.runAtomicNumberSymbol()[source]

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
createSimulationFiles(path, simulationPath, hdf5_group)[source]
current_A
detectorAzimuthalAngle_deg
detectorChannelWidth_eV
detectorCrystalDistance_cm
detectorCrystalRadius_cm
detectorCrystalThickness_cm
detectorNoise_eV
elasticCrossSectionScalingFactor
energyLossScalingFactor
energy_keV
filename
generateBaseFilename()[source]
getFilenameSuffixes()[source]
getParameters()[source]
getProgramVersionFilepath(simulationPath)[source]
isDone(simulationPath, hdf5_group=None)[source]
modelXrayBremsstrahlung
name
numberContinuumWindows
numberElectrons
numberEnergyWindows
numberLayersX
numberLayersY
numberLayersZ
numberPhotons
removeInputsFiles()[source]
resultsBasename
setParameters(parameters)[source]
solidAngle_sr
spectrumInterpolationModel
takeOffAngle_deg
time_s
pymcxray.Simulation.computeWeightFraction(atomicNumberRef, atomicWeights)[source]
pymcxray.Simulation.createAlloyBoxInSubstrate(elementsParticle, elementsSubstrate, boxParameters_nm)[source]
pymcxray.Simulation.createAlloyBoxInThinFilm(elementsParticle, atomicNumberSubstrate, boxParameters_nm, filmThickness_nm)[source]
pymcxray.Simulation.createAlloyBoxInVaccuum(elements, boxParameters_nm)[source]
pymcxray.Simulation.createAlloyBulkSample(elements, sampleName=None)[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.createAlloyMultiVerticalLayer(elementsLayers, layerWidths_nm)[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.createAlloyThinFilm(elements, filmThickness_nm)[source]
pymcxray.Simulation.createAlloyThinFilm2(elements, filmThickness_nm)[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.createPureBulkSample(atomic_number)[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.Simulation.create_weight_fractions(weight_fraction_step, number_elements)[source]
pymcxray.Simulation.create_weight_fractions_trace(weight_fraction_step, number_elements, min_weight_fraction, max_weight_fraction)[source]

pymcxray.SimulationsParameters module

Simulations parameters

class pymcxray.SimulationsParameters.SimulationsParameters[source]

Bases: dict

addCompute(parameterKey)[source]
addFixed(parameterKey, value)[source]
addVaried(parameterKey, values)[source]
computeNumberXrays(experiment)[source]
computeNumberXraysFilepath
fixedParameters
getAllSimulationParameters()[source]
getVariedParameterLabels()[source]
variedParameters
class pymcxray.SimulationsParameters.SimulationsParametersFixed[source]

Bases: object

addExperiment(experiment)[source]
getAllSimulationParameters()[source]

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 dictionary prm_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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testConstants()[source]

First test to check if the testcase is working with the testing framework.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

test_create_multi_horizontal_layer()[source]

Test the create_multi_horizontal_layer method.

test_create_weight_fractions()[source]
test_create_weight_fractions_trace()[source]
test_create_weight_fractions_trace_speed_test_three_elements()[source]
test_create_weight_fractions_trace_speed_test_two_elements()[source]

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

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.

setUp()[source]

Setup method.

tearDown()[source]

Teardown method.

testSkeleton()[source]

First test to check if the testcase is working with the testing framework.

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.

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

Indices and tables