McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics

McStas

About McStas
 Conditions of use
 Authors/Contacts
 Project funding

Download
 Components
 Other Downloads (share)

Mailing list

Search web/mailinglist

Documentation
 Wiki (GitHub)
 McStas manual
 Publications

Links

Report bugs (GitHub)

Code-repository (GitHub)


McStas: KDSource

[ Identification | Description | Examples | Input parameters | Links ]

The KDSource Component

Distributional source, based on a MCPL-format particle list, on which the Kernel Density Estimation (KDE) method is applied.

Identification

  • Site:
  • Author: O.I.Abbate, N.S.Schmidt, updates for McStas by T.Kittelmann and P.Willendrup
  • Origin: Instituto Balseiro
  • Date: Dec 2022 / May 2026

Description

Distributional source, based on a MCPL-format particle list, on which
the Kernel Density Estimation (KDE) method is applied.

It allows sampling more particles than the number present in a virtual,
previously generated virtual source, without repeating samples, controlled via the nloop
input parameter.

To function, this component requires a KDSource installation v.2.0.2 or later, as
distributed on conda-forge and pypi and included with (conda-based) McStas 3.7.0 or later.

As inputs the component needs access to all of:
  1. The original MPCL file
  2. Outputs of a KDSource-analyzed / optimized KDE source:
    • An XML parameter-file containing the needed configuration
    • A "bandwidth" file (source_bws)
For information on performing KDSource analysis, please refer to the KDSource example notebooks and the KDSource online documentation (links below).

Examples

(Test cases in bold)

Input parameters

Parameters in boldface are required; the others are optional.
NameUnitDescriptionDefault
filenamestrName of the XML parameters file containing KDSource definition.0
EminmeVLower energy bound. Particles found in the MCPL-file below the limit are skipped.0
EmaxmeVUpper energy bound. Particles found in the MCPL-file above the limit are skipped.FLT_MAX
nloopintNumber of times to loop through the file.1
AT ( , , ) RELATIVE
ROTATED ( , , ) RELATIVE

Links


[ Identification | Description | Examples | Input parameters | Links ]

Generated on mcstas 3.8.4


Last Modified: Friday, 11-Sep-2026 15:00:08 CEST
Search website mailinglist archive GitHub repos