Giter Club home page Giter Club logo

pymontecarlo's Introduction

Logo pyMonteCarlo

PyPI

pyMonteCarlo is a programming interface to run identical simulations using different Monte Carlo programs. The interface was designed to have common input and output that are independent of any Monte Carlo code. This allows users to combine the advantages of different codes and to compare the effect of different physical models without manually creating and running new simulations for each Monte Carlo program. The analysis of the results is also simplified by the common output format where results are expressed in the same units.

pyMonteCarlo is currently under development.

Documentation

The documentation contains the installation instructions, tutorials, supported Monte Carlo programs and API.

License

pyMonteCarlo is licensed under Apache Software License 2.0.

Citation

Pinard, P., Demers, H., Gauvin, R., & Richter, S. (2013). pyMonteCarlo: A Common Programming Interface for Running Identical Simulations using Different Monte Carlo Programs. Microscopy and Microanalysis, 19(S2), 822-823. doi:10.1017/S1431927613006107

@article{pinard2013,
    author={Pinard, P.T. and Demers, H. and Gauvin, R. and Richter, S.},
    title={pyMonteCarlo: A Common Programming Interface for Running Identical Simulations using Different Monte Carlo Programs},
    journal={Microscopy and Microanalysis},
    volume={19},
    number={S2},
    publisher={Cambridge University Press},
    year={2013},
    pages={822–823},
    DOI={10.1017/S1431927613006107}
}

Build status

Package CI build Code coverage
pymontecarlo CI Codecov
pymontecarlo-gui CI Codecov
pymontecarlo-casino2 CI Codecov
pymontecarlo-penepma CI Codecov
pypenelopetools CI Codecov

Contributors

Release notes

1.1.0

  • Fix issues with newer releases of dependencies

Copyrights

Copyright (c) 2011 - 2016/06, Silvia Richter and Philippe Pinard

Copyright (c) 2016/06 - , Philippe Pinard

pymontecarlo's People

Contributors

0b11001111 avatar drix00 avatar ppinard avatar silrichter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pymontecarlo's Issues

Restructure pymontecarlo

This is a general issue to discuss improvements to pymontecarlo and take the time to clearly define the goals of this program.

Looking back at my initial design of pymontecarlo, I think there are some serious shortcomings that need to be addressed and rethought. Here is a list I came up with after observing users during the Monte Carlo workshop in Aachen and from discussions with @drix00 and @silrichter. I also propose some solutions.

  1. Whether it is expert and beginner users, Monte Carlo simulations are usually used in EPMA with a clear goal in mind, e.g. calculate intensities/k-ratios, evaluate the size of the interaction volume, obtain a spectrum to compare with experimental results, etc. This usually involves running more than one simulation (different accelerating voltage, sample composition, etc.). This is something that is currently not easy to do in pymontecarlo. Most of the post-calculations have to be done manually.

I propose to create a class Task. Each Task would have a clear objective, e.g. calculate k-ratios. The class would ensure that the simulated options can meet this objective. After the simulations, it will collect the results and calculate new ones based on that objective.

class Task:

    def apply(self, list_options):
        raise NotImplementedError

    def calculate(self, list_options):
        raise NotImplementedError

    @property
    def results(self):
        raise NotImplementedError
  1. The file format, XML for options and HDF5 for results, is confusing. I propose to only used HDF5 and save the options either as attribute or in special datasets. I also propose to create the extension .mcoptions instead of .h5.

  2. The class Options has currently two roles: to create several simulations by adding parameters, e.g. different beam energies, and to store the parameter of a single simulation. I propose to separate these roles, creating an OptionsBuilder for the first role and simplying the Options to only store the parameters for a single simulation.

  3. I would rename the Geometry class to Sample for clarity.

  4. I would take the expansion operation out of the Converter class. The expansion is to convert a series of parameters into a list of Options. This is often specific to each MC program and it should be part of the OptionsBuilder.

  5. I would remove the class Results and ResultsContainer, and simply stores the results inside the Options. An Options that has not been simulated would simply have no results.

  6. In pymontecarlo, a Detector corresponds to a virtual detector and not a physical one that would be attached to an electron microscope. Each Detector is expected to yield one Result. Although I would keep this philosophy, I think the current detector definition could be simplified. For instance, the PhotonIntensityDetector is responsible for storing the generated and emitted intensities. This should be two detectors. Subpackages should be used to separate different types of detectors, instead of having all of them in the module pymontecarlo.options.detector.

  7. It is important that once a simulation was executed, that its options cannot be modified. It is currently done by the concept of freezing. I think the whole structure of pymontecarlo could be simplified if the Options class and all its components (e.g. beam, sample, detectors, limits, etc.) would be immutable. To prevent having too many arguments in the __init__ we could create Builder classes instead. While complete immutability is difficult to implement in Python, I would propose to either use the metaclass trick of pyxray (pyxray.cbook.Immutable).

  8. A missing functionality of pymontecarlo is the ability to use other parameters of an option to define a new one. For instance, it should be possible to easily set the maximum energy of an ED spectrum to the beam energy. I propose to create the following interface:

class Lazy:

    def resolve(self, options):
        raise NotImplementedError

Upon the creation of an Options object, the resolve method should be called.

  1. I would remove the use of namespaces (pymontecarlo.program.casino, pymontecarlo.program.monaco, etc.) and instead use longer root package (pymontecarlo_casino, pymontecarlo_monaco, etc.) as it was done for pyHMSA.

  2. The distribution of pymontecarlo to the different operating system (Windows, MacOS, Linux) is quite complicated due to several factors.

  • First, it is difficult to freeze (i.e. include the Python distribution) due to the use of setuptools' entry points. These entry points are however essential to allow pymontecarlo to discover installed programs, handlers to parse XML or HDF5 results, GUI interfaces, etc. py2exe, py2app, cx_freeze do not support entry points. For Windows, the project python_embedded_launcher works well, but I did not find alternative to MacOS and Linux.

  • Secondly, it is not clear up to now whether pymontecarlo should distribute the Monte Carlo program or ask the user to download/install them separately. I propose that we provide all freely available MC programs with pymontecarlo and configure pymontecarlo accordingly to use them. These would include Casino, WinXRay, PENEPMA, NISTMonte and MONACO. For PENEPMA, I think we should only support the version distributed by the Barcelona group.

  • Thirdly, to facilitate installation, it should be possible to run pymontecarlo directly after extracting it from a ZIP, i.e. no installation, no administrative rights. On Linux, we can probably assume that Python 3 is installed. This assumption should not be made for Windows and MacOS.

Finally here is some class definitions for the above proposals:
pymontecarlo

Simulation in Casino2 fails with current pyMonteCarlo version

Trying to run the following code snippet results in the attached error. I don't know if that's caused by incomplete options, a bug in the current version of pyMonteCarlo or a not detected Casion2 instance. My guess is the last one since I was not able to follow the installation guide (https://github.com/pymontecarlo/pymontecarlo/wiki/Simple-example) one to one.

#!/usr/bin/env python3
"""
example script for demonstrating usage of pyMonteCarlo
"""

# Standard library modules.
import math
import sys

# Local modules
from pymontecarlo.options.analysis.kratio import KRatioAnalysis
from pymontecarlo.options.beam.gaussian import GaussianBeamBuilder
from pymontecarlo.options.detector import PhotonDetector
from pymontecarlo.options.material import Material
from pymontecarlo.options.options import OptionsBuilder
from pymontecarlo.options.sample import VerticalLayerSample
from pymontecarlo.options.sample.base import Layer
from pymontecarlo.project import Project
from pymontecarlo.runner.local import LocalSimulationRunner
from pymontecarlo_casino2.program import Casino2ProgramBuilder


def generate_options_1():
    """
    # Photonenintensität vs. Energie (3keV-15keV, 2keV-Schritte)
    # reines Substrat (Si, Fe)
    """
    program_bilder = Casino2ProgramBuilder()
    program_bilder.add_number_trajectories(100)

    programs = program_bilder.build()
    sample = VerticalLayerSample(left_material=Material.pure(14),
                                 right_material=Material.pure(14),
                                 layers=[Layer(Material.pure(26), 200e-9)])

    photon_detector = PhotonDetector('myDetector', math.radians(35.0))

    analysis = KRatioAnalysis(photon_detector)

    beam_builder = GaussianBeamBuilder()
    beam_builder.add_energy_eV(15e3)
    beam_builder.add_diameter_m(10e-9)
    beam_builder.add_linescan_x(-1000e-9, 1001e-9, 100e-9)

    beams = beam_builder.build()

    options_builder = OptionsBuilder()
    options_builder.add_sample(sample)
    options_builder.add_analysis(analysis)
    for program in programs:
        options_builder.add_program(program)
    for beam in beams:
        options_builder.add_beam(beam)

    options = options_builder.build()

    return options


def simulate(project, options):
    with LocalSimulationRunner(project, max_workers=3) as runner:

        futures = runner.submit(*options)

        print('{} simulations launched'.format(len(futures)))

        while not runner.wait(1):
            print(runner.progress)

            print('{} simulations succeeded'.format(runner.done_count))
            print('{} simulations failed'.format(runner.failed_count))
            for future in runner.failed_futures:
                print(future.exception())


def main(argv=None):
    options = generate_options_1()

    project = Project()

    simulate(project, options)

    project.recalculate()

    # odf = project.create_options_dataframe()
    # rdf = project.create_results_dataframe()

    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv))

error log
log.txt

packages installed in virtual environment
pip.txt

Implement concept of "task"

Whether it is expert and beginner users, Monte Carlo simulations are usually used in EPMA with a clear goal in mind, e.g. calculate intensities/k-ratios, evaluate the size of the interaction volume, obtain a spectrum to compare with experimental results, etc. This usually involves running more than one simulation (different accelerating voltage, sample composition, etc.). This is something that is currently not easy to do in pymontecarlo. Most of the post-calculations have to be done manually.

I propose to create a class Task. Each Task would have a clear objective, e.g. calculate k-ratios. The class would ensure that the simulated options can meet this objective. After the simulations, it will collect the results and calculate new ones based on that objective.

class Task:

    def apply(self, list_options):
        raise NotImplementedError

    def calculate(self, list_options):
        raise NotImplementedError

    @property
    def results(self):
        raise NotImplementedError

Branch v0.1.0 should be deleted

The branch v0.1.0 does not seem to be used anymore. It should be deleted, but the branch have 3 commits ahead so they should be reviewed and maybe merged with master branch.

When the commits are reviewed the branch can be deleted with this command:

git push origin --delete v0.1.0

Documentation for the project

I did not find the documentation for the project on Read the Docs. I think we should start a documentation for the project and build it with Read the Docs. Some documentation is present in pymontecarlo/doc/www/.

  1. Should move it in the recommended folder: docs/conf.py?
  2. Does it matter who is adding it to Read the Docs?
  3. What is the best way to add the API doc with Sphinx?

Thanks

Installation problem of pypenelopelib in development mode on windows

From @drix00

The package cannot be install because of a compilation error with the following command:

#!cmd

py -3 -m pip install -e pypenelopelib

The fortran compiler is installed and visible:

#!cmd

D:\work\codings\pymontecarlo> gfortran --version
GNU Fortran (GCC) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

This is on windows 7 64-bit.

The full output:

#!txt

D:\work\codings\pymontecarlo> py -3 -m pip install -e pypenelopelib
Obtaining file:///D:/work/codings/pymontecarlo/pypenelopelib
Installing collected packages: pypenelopelib
  Running setup.py develop for pypenelopelib
    Complete output from command C:\Python34\python.exe -c "import setuptools, tokenize; __file__='D:\\work\\codings\\pymontecarlo\\pypenelopelib\\setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
    running develop
    running egg_info
    writing pypenelopelib.egg-info\PKG-INFO
    writing top-level names to pypenelopelib.egg-info\top_level.txt
    writing dependency_links to pypenelopelib.egg-info\dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pypenelopelib.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pypenelopelib.egg-info\SOURCES.txt'
    running build_ext
    building penelope library
    gfortran -shared -static-libgcc -static-libgfortran -o D:\work\codings\pymontecarlo\pypenelopelib\pypenelopelib\penelope.dll pypenelopelib/penelope.f pypenelopelib/pengeom.f pypenelopelib/penvared.f pypenelopelib/rita.f pypenelopelib/timer.f pypenelopelib/utils.f
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(read.o): In function `_gfortrani_convert_real':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/read.c:155:(.text$_gfortrani_convert_real+0x40): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `strtoflt128'
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(read.o): In function `_gfortrani_convert_infnan':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/read.c:229:(.text$_gfortrani_convert_infnan+0x52): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `strtoflt128'
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(write.o): In function `write_float':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/write_float.def:1272:(.text$write_float+0x1a0): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(write.o): In function `determine_en_precision':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/write_float.def:1185:(.text$write_float+0x87b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(write.o): In function `write_float':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/write_float.def:1272:(.text$write_float+0x8de): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
    /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libgfortran.a(write.o): In function `output_float_FMT_G_16':
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/write_float.def:1112:(.text$write_float+0xf82): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
    /usr/src/debug/gcc-4.8.3-5/libgfortran/io/write_float.def:1112:(.text$write_float+0x1803): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `quadmath_snprintf'
    collect2: error: ld returned 1 exit status
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "D:\work\codings\pymontecarlo\pypenelopelib\setup.py", line 134, in <module>
        cmdclass={'build_ext': build_ext},
      File "C:\Python34\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Python34\lib\site-packages\setuptools\command\develop.py", line 32, in run
        self.install_for_development()
      File "C:\Python34\lib\site-packages\setuptools\command\develop.py", line 117, in install_for_development
        self.run_command('build_ext')
      File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\work\codings\pymontecarlo\pypenelopelib\setup.py", line 29, in run
        library_dir = self.build_libpenelope()
      File "D:\work\codings\pymontecarlo\pypenelopelib\setup.py", line 75, in build_libpenelope
        subprocess.check_call(args)
      File "C:\Python34\lib\subprocess.py", line 561, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['gfortran', '-shared', '-static-libgcc', '-static-libgfortran', '-o', 'D:\\work\\codings\\pymontecarlo\\pypenelopelib\\pypenelopelib\\penelope.dll', 'pypenelopelib/penelope.f', 'pypenelopelib/pengeom.f', 'pypenelopelib/penvared.f', 'pypenelopelib/rita.f', 'pypenelopelib/timer.f', 'pypenelopelib/utils.f']' returned non-zero exit status 1

    ----------------------------------------
Command "C:\Python34\python.exe -c "import setuptools, tokenize; __file__='D:\\work\\codings\\pymontecarlo\\pypenelopelib\\setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps" failed with error code 1 in D:\work\codings\pymontecarlo\pypenelopelib

Uncertainty limit for x-ray families

Currently, it is not possible to define an uncertainty limit for a family of x-ray lines (e.g. Ka). One can only use the Ka1 or Ka2 transition. This limitation comes from the fact that x-ray families are not considered in PENEPMA.
The proposal is to back calculate what should be the uncertainty limit on Ka1 to get a Ka uncertainty less than 5% using the emission probabilities.

User interface

I sketched what I think the wizard to create new simulations should look like. The sketches are SVG files created using Inkscape. They are located in the folder sketch of the branch sketch. Comments are more then welcomed.

  1. Select type(s) of analysis

newsimulation_analysis

All types of analysis should be listed here. We might think of a way to categorize them if there are too many.

  1. Define sample

newsimulation_sample

The user first must define some materials (composition and density). Secondly, the user selects a type of geometry from the drop down menu. For the current example, material(s) are associated to each horizontal layer with one or more thicknesses. Note the preview button, where the selected geometry should be displayed in a 2D or possibly 3D plot, with the x, y and z axes. It should be possible to load/save the list of materials and the complete sample.

  1. Setup incident beam

newsimulation_beam

The user selects a type of beam (Gaussian, pencil, raster) from the drop-down menu and other properties such as the initial energy. The next step is to define the beam positions. This is down by selecting a type of pattern (single point, line scan, grid of points). The preview button should display the sample and the beam positions.

  1. Select program(s)

newsimulation_program

Select the program for the simulations. In this example, where a multi-layer sample was selected, WinX-Ray is not available since it does not support this type of sample.

  1. Setup simulation limit

newsimulation_limit

Setup the simulation limit for each program. Each program can have different limits.

  1. I think the next pages should be for
  • parameters related to the selected analyses (e.g. take-off angle of X-ray detector, which standards for k-ratios)
  • advanced parameters for the Monte Carlo programs (e.g. models, interaction forcings)

New analysis in pyMonteCarlo: depth range and lateral range

I need to compute the depth range and lateral range for a collaborator with CASINO. I could write a script for only CASINO, but it will be better if I do it in pyMonteCarlo. Before starting working on it, I like to have some pointer or direction how to do that.

  1. Where I should put the calculation of the range?
  2. Which results I have to use?
  3. Where I should put the option related to the analysis? like the fraction to define the range (0.95)
  4. Should I checkout the master branch or the restructured branch are not merged?
  5. For the GUI, any documentation how to build it?
  6. For the GUI, any documentation how to install/use it?
  7. Later I will also like to use a line scan across an interface.
    1. Is the vertical interface implemented?
    2. Is the line scan implemented?

Anything else?
Thanks

Modify detector structure

In pymontecarlo, a Detector corresponds to a virtual detector and not a physical one that would be attached to an electron microscope. Each Detector is expected to yield one Result. Although I would keep this philosophy, I think the current detector definition could be simplified. For instance, the PhotonIntensityDetector is responsible for storing the generated and emitted intensities. This should be two detectors. Subpackages should be used to separate different types of detectors, instead of having all of them in the module pymontecarlo.options.detector.

pymontecarlo-all on ubuntu 16.04

Hi,
it took me a while but I was finally able to install pymontecarlo-all. Anything works fine except for the actual simulation which fails with the following exception:

  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/lukas/Workspace/GFE/pyMonteCarlo/env_pymontecarlo/pymontecarlo/lib/python3.5/site-packages/pymontecarlo/runner/local.py", line 41, in target
    worker.run(token, simulation, outputdir)
  File "/home/lukas/Workspace/GFE/pyMonteCarlo/env_pymontecarlo/pymontecarlo/lib/python3.5/site-packages/pymontecarlo_casino2/worker.py", line 58, in run
    with self._create_process(args, stdout=stdout, cwd=cwd) as process:
  File "/home/lukas/Workspace/GFE/pyMonteCarlo/env_pymontecarlo/pymontecarlo/lib/python3.5/site-packages/pymontecarlo/program/worker.py", line 51, in _create_process
    return subprocess.Popen(*args, startupinfo=startupinfo, **kwargs)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)

Need package pybtex to build the doc

From @drix00

Should we add the package pybtex in the requirements of the setup.py?
I have added the information in the documentation on how to build the developer doc (still not committed and submitted).
Hendrix

Remove namespace

I would remove the use of namespaces (pymontecarlo.program.casino, pymontecarlo.program.monaco, etc.) and instead use longer root package (pymontecarlo_casino, pymontecarlo_monaco, etc.) as it was done for pyHMSA.

DataFrame

I do not fully understand the functions Project.create_options_dataframe and Project.create_results_dataframe. What exactly does the settings parameter stand for? Setting it to None ends in a empty result.

Remove XML and store options and results in HDF5

The file format, XML for options and HDF5 for results, is confusing. I propose to only used HDF5 and save the options either as attribute or in special datasets. I also propose to create the extension .mcoptions instead of .h5.

Distribution on different operating systems

The distribution of pymontecarlo to the different operating systems (Windows, MacOS, Linux) is quite complicated due to several factors.

  • First, it is difficult to freeze (i.e. include the Python distribution) due to the use of setuptools' entry points. These entry points are however essential to allow pymontecarlo to discover installed programs, handlers to parse XML or HDF5 results, GUI interfaces, etc. py2exe, py2app, cx_freeze do not support entry points. For Windows, the project python_embedded_launcher works well, but I did not find alternative to MacOS and Linux.

  • Secondly, it is not clear up to now whether pymontecarlo should distribute the Monte Carlo program or ask the user to download/install them separately. I propose that we provide all freely available MC programs with pymontecarlo and configure pymontecarlo accordingly to use them. These would include Casino, WinXRay, PENEPMA, NISTMonte and MONACO. For PENEPMA, I think we should only support the version distributed by the Barcelona group.

  • Thirdly, to facilitate installation, it should be possible to run pymontecarlo directly after extracting it from a ZIP, i.e. no installation, no administrative rights. On Linux, we can probably assume that Python 3 is installed. This assumption should not be made for Windows and MacOS.

Lazy parameter

A missing functionality of pymontecarlo is the ability to use other parameters of an option to define a new one. For instance, it should be possible to easily set the maximum energy of an ED spectrum to the beam energy. I propose to create the following interface:

class Lazy:

    def resolve(self, options):
        raise NotImplementedError

Upon the creation of an Options object, the resolve method should be called.

Immutable options and parameters

It is important that once a simulation was executed, that its options cannot be modified. It is currently done by the concept of freezing. I think the whole structure of pymontecarlo could be simplified if the Options class and all its components (e.g. beam, sample, detectors, limits, etc.) would be immutable. To prevent having too many arguments in the __init__ we could create Builder classes instead. While complete immutability is difficult to implement in Python, I would propose to either use the metaclass trick of pyxray (pyxray.cbook.Immutable).

Interface to display results

I'm working at a interface to display the results of a simulation at the moment.
For that I need some data to display. So there are mainly to questions for now:

  1. Are there any sample results to use?
  2. How should I read the data? I reckon it won't be necessary to read the HDF5 file directly. So will there be any function to do this?

Expansion step of options should be a separate class

I would take the expansion operation out of the Converter class. The expansion is to convert a series of parameters into a list of Options. This is often specific to each MC program and it should be called by OptionsBuilder.

class Expander:

    def expand(self, optionsbuilder):
        return [options1, options2, ...]

Preview of sample geometry

As shown in #33, pymontecarlo should allow users to preview the generated sample. The same preview capabilities should also be later used to visualize the electron trajectories. Although a 3D preview of the sample geometry is more eye-catching, the samples currently available in pymontecarlo do not require 3D for their comprehension. I propose to design a 2D preview where the sample can be viewed from different perspectives. I would summarize the requirements as follows:

  1. Support all currently implemented samples (substrate, inclusion, horizontal layers, vertical layers and sphere)
  2. Display XY, XZ, YZ perspectives
  3. Display coordinate system
  4. Display the sample sub-structures (e.g. layers) and the materials used (2 modes)
  5. Allow zooming and panning
  6. Save one or many perspectives to disk in a vector-based file format (e.g. svg, pdf)
  7. Display intersection of electron beam with sample (i.e. initial beam positions)
  8. Display electron trajectories and/or collisions. Allow different colors for backscattered, transmitted and absorbed electrons.

h5py-numpy incompatibility

h5py currently struggles with current numpy version 1.14 but 1.13.* is fine as described in this issue. pyMonteCarlo may enforce a older version until they have solved that.

(env_auto) [vm-user@localhost scripts]$ python simulation_simple.py 
/home/vm-user/Workspace/pymontecarlo_test/env_auto/lib64/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

Status of PENELOPE in pyMonteCarlo

I will like to use pyMonteCarlo with the command line interface to do batch simulation with PENELOPE/PENEPMA. I like to know what is the status of the project in regard of the restructure of pyMonteCarlo.

Some point I am not sure:

  1. Which projects I need?
  2. Any special installation step I need to do?
  3. Should I just checkout from the master branch of each project?
  4. Later I will like to use a HPC, can the CLI do that or where I should modify/add it?
  5. I think I have the latest version of PENELOPE on a private bitbucket project. Should I make it public? What about the distribution restriction of PENELOPE? In Canada, we cannot have access it unless the authors send it to us.

Anything else I need to know?
Thanks

Modify results structure

I would remove the class Results and ResultsContainer, and simply stores the results inside the Options. An Options that has not been simulated would simply have no results.

Incident Beam

I recently pushed a version of the BeamWidget and BeamPositionWidget (pymontecarlo/pymontecarlo-gui@febfe72) where I implemented everything I was able to.

BeamWidget

  • beams(self) is supposed to return a list of beams but we only set up one. What's the idea behind that function?

BeamPositionWidget

  • What is the Edit-Button supposed to do? Does is modify a certain position or a whole scan?
  • How can I make QTableView's content width make fit the view?
  • Currently I use text to describe a pushbutton's functionality but I want to use icons as in your sketch. Does Qt already ships some default icons or where can I get them from?

Simplify Options with builder pattern

The class Options has currently two roles: to create several simulations by adding parameters, e.g. different beam energies, and to store the parameter of a single simulation. I propose to separate these roles, creating an OptionsBuilder for the first role and simplying the Options to only store the parameters for a single simulation.

Run CASINO from command line

It would significantly simplify the integration of Casino 2 if a simulation could be started from the command line, like for WinX-ray.

fresh install

In order to install the latest version pymontecarlo on @silrichter's machine I decided to make a test setup first using Wndows 7 and Fedora 27 in VMs. I followed the tutorial and used the latest copies of pymontecarlo, pymontecarlo-casino2 and pyxray. While pymontecarlo's tests succeed pymontecarlo-casino fails. The output can be found in the attachment.

Am I missing anything? On my machine anything works just fine but I also have kind of a messed up setup.

pymontecarlo_casino2_nosetest.txt

Branching model

What's the idea behind pymontecarlos branching model? When I want to set up a productive system, which is the best source to get a stable and up to date version of pymontecarlo? Can I simply go with the packages provided on PyPI or are they outdated?

Bug!?

There is a bug occurring when I try to launch my SampleFigure script for example (or any other code which uses pyMonteCarlo). Did I just messed up my local repository or is it a bug in our code?

Here's my error log

Hello!

I am known as Nilda and I am finally joining the team. :) Regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.