Skip to main content

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/

Metadata

Release files for kdsource 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kdsource 0.2.2
File Size Uploaded
kdsource-0.2.2.tar.gz 1.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for kdsource 0.2.2
File
kdsource-0.2.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
kdsource-0.2.2-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
kdsource-0.2.2-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
kdsource-0.2.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details
kdsource-0.2.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details
kdsource-0.2.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
kdsource-0.2.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
kdsource-0.2.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
kdsource-0.2.2-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 3.9 MB

Release files / kdsource-0.2.2.tar.gz

Download URL kdsource-0.2.2.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
672d953e22f0e890cb7f73a10c8b6631dc14318ea494344dd43b792e2a83a07c
BLAKE2b-256 checksum
How to use checksums
ef62586d5fb90f679bd79ca3a3db8491f27964072b850b9ee29d673d2f85896c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-win_amd64.whl

Download URL kdsource-0.2.2-py3-none-win_amd64.whl
Size 218.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
b70cdb5e6b8af63e6be8073b4b7167905abe4715f0bb9e5b31a5eecdfd719a50
BLAKE2b-256 checksum
How to use checksums
948b8c5180c46b66dd196c2eb7a6a9b960be8836e7d8c7006c04f498ee2e7763
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-musllinux_1_2_x86_64.whl

Download URL kdsource-0.2.2-py3-none-musllinux_1_2_x86_64.whl
Size 329.9 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
151585d1d337b2ec016443f83f48f21fe04078e64e728e963a83b7d9a788ca8b
BLAKE2b-256 checksum
How to use checksums
e811b6281c2b4e67297ff7b91b43e24bbeaade8ae973173d493bc904a2a9c5be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-musllinux_1_2_aarch64.whl

Download URL kdsource-0.2.2-py3-none-musllinux_1_2_aarch64.whl
Size 323.6 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
503a32eb31ede178ebfb44ad9ad90cacb19a50d008c5aeb98e4c527751e939c9
BLAKE2b-256 checksum
How to use checksums
c5c2d2dbaa3ac704445f64f68a15a51366898f240d0dd7302dd7173707033d0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL kdsource-0.2.2-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 328.2 kB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
85e47aeb735204b7a6a30fd1c9158e64a73cac697bb40b0bca560e5082d02e83
BLAKE2b-256 checksum
How to use checksums
0f54cb39a2c268f59644191cea893e432f62b8b6672a4e6f8b8db8946ea7542d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL kdsource-0.2.2-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 318.5 kB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2e8660dd4a6ccedc8def4f386ee4e092c2ed0d8a7e87244d4bd7afe0a3c371af
BLAKE2b-256 checksum
How to use checksums
c369d114f64e065a2e909ab8cc328af31bbb5e5d16b27522acc334f0533c2349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kdsource-0.2.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 322.8 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
14bb5dc43b3e95e86dea76c1a2d99f3fe929b50ccdceb24a9124641ee0116be9
BLAKE2b-256 checksum
How to use checksums
5b1bffab778edf063c2aa0ed1189e398089dd6a3767f8144d3a93a96e5a73627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL kdsource-0.2.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 314.2 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9a37e3718d63d76a8f7dd2aac6a547700888baa4646f16c49f92cdef72fb17bd
BLAKE2b-256 checksum
How to use checksums
76b08a0fe0048eadcf3cbdb85170a664835d185db261d79b3c85b6d1aa141ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-macosx_11_0_arm64.whl

Download URL kdsource-0.2.2-py3-none-macosx_11_0_arm64.whl
Size 271.7 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5bbf5d7944e56233ab745e8fcad2ad0a7cf4f8a5368f673422a7c2ca4f02fb55
BLAKE2b-256 checksum
How to use checksums
cbf23b7bbfad9e779855c2c650e395b92480a2a828783a3bff25686695098563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / kdsource-0.2.2-py3-none-macosx_10_9_x86_64.whl

Download URL kdsource-0.2.2-py3-none-macosx_10_9_x86_64.whl
Size 288.5 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
325e7d7756c4b758770c377eeac6d32714deca3911853e75ce3d184104c62a5a
BLAKE2b-256 checksum
How to use checksums
bdd7d39c07f736d81888fbff66b5e60cbda20a73ea1234dd4466211e1966b875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

10 release files

0.1.99

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page