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.2.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.2-py3-none-win_amd64.whl (218.2 kB view details)

Uploaded Python 3Windows x86-64

kdsource-0.2.2-py3-none-musllinux_1_2_x86_64.whl (329.9 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

kdsource-0.2.2-py3-none-musllinux_1_2_aarch64.whl (323.6 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

kdsource-0.2.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl (328.2 kB view details)

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

kdsource-0.2.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (318.5 kB view details)

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

kdsource-0.2.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (322.8 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

kdsource-0.2.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (314.2 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

kdsource-0.2.2-py3-none-macosx_11_0_arm64.whl (271.7 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

kdsource-0.2.2-py3-none-macosx_10_9_x86_64.whl (288.5 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: kdsource-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 672d953e22f0e890cb7f73a10c8b6631dc14318ea494344dd43b792e2a83a07c
MD5 2ed08b593267a2d59f38aa1fea046dc5
BLAKE2b-256 ef62586d5fb90f679bd79ca3a3db8491f27964072b850b9ee29d673d2f85896c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2.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.2-py3-none-win_amd64.whl.

File metadata

  • Download URL: kdsource-0.2.2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 218.2 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.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b70cdb5e6b8af63e6be8073b4b7167905abe4715f0bb9e5b31a5eecdfd719a50
MD5 a83704e3245b4455b07d7b419cf3f3bc
BLAKE2b-256 948b8c5180c46b66dd196c2eb7a6a9b960be8836e7d8c7006c04f498ee2e7763

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 151585d1d337b2ec016443f83f48f21fe04078e64e728e963a83b7d9a788ca8b
MD5 43f707d6e2dda10c2af19033901372a5
BLAKE2b-256 e811b6281c2b4e67297ff7b91b43e24bbeaade8ae973173d493bc904a2a9c5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 503a32eb31ede178ebfb44ad9ad90cacb19a50d008c5aeb98e4c527751e939c9
MD5 b8eb1b273d0d4437b3a09509181d23f7
BLAKE2b-256 c5c2d2dbaa3ac704445f64f68a15a51366898f240d0dd7302dd7173707033d0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85e47aeb735204b7a6a30fd1c9158e64a73cac697bb40b0bca560e5082d02e83
MD5 1f4146b55039d7bd6aa49d262503109e
BLAKE2b-256 0f54cb39a2c268f59644191cea893e432f62b8b6672a4e6f8b8db8946ea7542d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2e8660dd4a6ccedc8def4f386ee4e092c2ed0d8a7e87244d4bd7afe0a3c371af
MD5 d3e66437da333a0bb408c65dbc006054
BLAKE2b-256 c369d114f64e065a2e909ab8cc328af31bbb5e5d16b27522acc334f0533c2349

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 14bb5dc43b3e95e86dea76c1a2d99f3fe929b50ccdceb24a9124641ee0116be9
MD5 3e156e16717b1120df155c9cd671fefc
BLAKE2b-256 5b1bffab778edf063c2aa0ed1189e398089dd6a3767f8144d3a93a96e5a73627

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9a37e3718d63d76a8f7dd2aac6a547700888baa4646f16c49f92cdef72fb17bd
MD5 4931ed58d2c16799c8ffd36f32ffc9c8
BLAKE2b-256 76b08a0fe0048eadcf3cbdb85170a664835d185db261d79b3c85b6d1aa141ae8

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bbf5d7944e56233ab745e8fcad2ad0a7cf4f8a5368f673422a7c2ca4f02fb55
MD5 bd4773a20b759eb697b16ea19f5413df
BLAKE2b-256 cbf23b7bbfad9e779855c2c650e395b92480a2a828783a3bff25686695098563

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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.2-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kdsource-0.2.2-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 325e7d7756c4b758770c377eeac6d32714deca3911853e75ce3d184104c62a5a
MD5 01d864fc2ef836a77d771f23c15f3a72
BLAKE2b-256 bdd7d39c07f736d81888fbff66b5e60cbda20a73ea1234dd4466211e1966b875

See more details on using hashes here.

Provenance

The following attestation bundles were made for kdsource-0.2.2-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