Skip to main content

Tool for modelling distributional particle sources for Monte Carlo simulations, with Kernel Density Estimation.

Project description

logo

KDSource Documentation Status License CMake Python 3.10

This is source version of KDSource, a tool for Monte Carlo particle sources generation using Kernel Density Estimation. Visit our Documentation Page for more details!

KDSource assists Monte Carlo beams and shielding calculations, improving tally results in difficult problems. It allows to model big systems (e.g.: investigation reactor guides hall) thru spatial or temporal coupling of different simulations in different transport codes, implementing as well variance reduction.

It processes particle lists recorded as output of a simulation (e.g.: passing thru a window), to be used as input in another one. It estimates density distribution in energy, position and direction by means of Kernel Density Estimation (KDE) technique, allowing visualizing it as well as using it to produce new particles (artificial, but with the same estimated density). This allows to increase the number of source particles in the second simulation, improving its statistics (variance reduction).

KDSource uses MCPL particle lists format.

In TRIPOLI-4 and McStas it is possible "on-the-fly" sampling during simulations, while for other codess it is necessary to record the source particle list as MCPL files before the simulation.

Contents:

The KDSource package consists in the following tools:

  • Python API: Allows creating, optimizing, analyzing, plotting, and saving KDE sources. Optimización consists in automatic selection of bandwidth. Internally, it uses KDEpy library for KDE.

  • C API: Allows loading the sources saved with Python, and generating new synthetic samples. These follow the estimated distribution, and can be saved in a new MCPL file or be introduced directly in a simulation.

  • Command line API: Allows easily producing samples, based on sources saved with Python. Also allows to access templates and communication files, as well as MCPL applications.

Installation:

This is currently being updated with the intention of providing conda and PyPI packages. For the time being, note that you can install via pip if your machine has compilers and libxml2 installed:

pip install "git+https://github.com/KDSource/KDSource"

Note that on Linux, libxml2 can most likely be installed from your package manager. For instance on Ubuntu:

   $ sudo apt-get update
   $ sudo apt-get install libxml2-dev

On macOS, libxml2 is most likely part of the standard SDKs.

After installation, you should be able to import kdsource.api as kds in Python, and have command-line tools like kdsource-config and kdsource-resample available.

Usage examples and templates

See the documentation page for usage instructions, tutorials, and a detailed documentation of all the functionalities in KDSource.

Usage examples can be found in the docs/examples subdirectory. At the moment these are:

  • Verification.ipynb: Analytic example. KDSource is used to generate a source from a particle list sampled from an known correlated distribution, and the generated particles distributions are compared with the analytical density.

Issues and contributing

If you are having trouble using the package, please let us know by creating a Issue on GitHub and we'll get back to you.

Contributions are very welcome. To contribute, fork the project, create a branch and submit a Pull Request.

Reference

Usage of the KDSource package is allowed in the terms detailed in the LICENSE file. However, if you use it for your work, we would appreciate it if you would use the following reference:

Abbate, O. I., Schmidt, N. S., Prieto, Z. M., Robledo, J. I., Dawidowski, J., Márquez, A. A., & Márquez Damián, J. I. KDSource, a tool for the generation of Monte Carlo particle sources using kernel density estimation [Computer software]. https://github.com/KDSource/KDSource

For how to reference MCPL, refer to: https://mctools.github.io/mcpl/about/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kdsource-0.2.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kdsource-0.2.0-py3-none-win_amd64.whl (217.8 kB view details)

Uploaded Python 3Windows x86-64

kdsource-0.2.0-py3-none-musllinux_1_2_x86_64.whl (329.5 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

kdsource-0.2.0-py3-none-musllinux_1_2_aarch64.whl (323.2 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

kdsource-0.2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl (327.9 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ x86-64manylinux: glibc 2.28+ x86-64

kdsource-0.2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (318.3 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

kdsource-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (322.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

kdsource-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (314.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

kdsource-0.2.0-py3-none-macosx_11_0_arm64.whl (271.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

kdsource-0.2.0-py3-none-macosx_10_9_x86_64.whl (288.3 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file kdsource-0.2.0.tar.gz.

File metadata

  • Download URL: kdsource-0.2.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kdsource-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3d5915ec1e060b127213b66dc356a0f6307f0c7d6e5e284714c22c18b83d9f71
MD5 d1d8d38e019b5b9cbd5c30bb5e7261fa
BLAKE2b-256 1fb381840281a1525baedb60856d30c672d05416d7219b3400f098ee001b0f7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0.tar.gz:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: kdsource-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 217.8 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kdsource-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 25c1617423588687e094bf342cf12503467288ee10a43d8c609d928ed02c3355
MD5 6c2c64a820642359690ee48f1286a6c5
BLAKE2b-256 d78f0b220f9e9db2bb1727cac9a85d7aa1e000b057dde4112930f6bcdbc15fff

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-win_amd64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3878c71e3637910b82280704bc43f784ee324eca0b229e2565cf3377ee57c566
MD5 bc6d6a6c95a2c96c1463f14b36c82633
BLAKE2b-256 a658922170032083c74196f31cc6f99ecf8ef1095c28f6201f4507a055274e64

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3b338f94d550d475899bd468f926da5a9ceb2b7eb51fa8e254a0ad2d8c7a2632
MD5 5badaf7f40c43aa02ee8845087a8248f
BLAKE2b-256 056ed0967022f6969f3d4bad90833e58869a97aed9bb49b1cef80564c6635605

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a4982c45fca311a056dafc32a0a78a850ef881d98b20dbeed3c7bc9159673808
MD5 5f55efa7512594f0cb596529f3e85ffe
BLAKE2b-256 483dfb984486f6b3ff995332a7d8054329a0ba8022fa48b6a4aaa32111be9cf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5163c63c08b12b8adca0a7d21373dfd9769195f9b5095b11c4e9a11cb7739aa8
MD5 9bff98c554f61a98472d1ab77ca4a18a
BLAKE2b-256 6200351c1ee76fcd6c34f7b5c040ffb277beb3a1960a858181be414fa20b68cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 57e54b480c41dffef960701857cd4e377482ce50899d4ef044de75137b9b8789
MD5 eedc5c1a3861f5765f8dd819b0b56045
BLAKE2b-256 b5a8c10264933c09ab3ef7abcaa059284e5f4ba9dec31f69da71d2ff9df3ffb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 a5e6b66dc741f93d560755eb5e7a96f89c9c01b546bddc53e6c077009a1de9ca
MD5 9e80875a452de4f020f8867d703c0c5f
BLAKE2b-256 1139ed38cfb0e35f67ea7af16b685fc00cb85cb6fbd4deced78b92fda1b75435

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1342faf837af4c91c5b8d574e75f17dce43c663fa64ee611393d6b9eace7bf9d
MD5 207fad3f6b4b0fb5e77d4fa82f5880c0
BLAKE2b-256 db206eddad1712fdf9c7ca95149bcb8d2b1ac7287a3a28071d8da498724ad8f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kdsource-0.2.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3aaf731adf4c5570e3ee502aca9e0acf93d1b46f872904c62bf0828ad539a225
MD5 28292c998a4efd71aa101fdce07d5303
BLAKE2b-256 cc784d604c828eeee5e940c91dcdca60a9e8f35873e0ce27f532a030d6c63d7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.0-py3-none-macosx_10_9_x86_64.whl:

Publisher: pypi.yml on KDSource/KDSource

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page