<?xml version="1.0" encoding="UTF-8"?>
<simulation xmds-version="2">
  <testing>
    <xsil_file name="photodetector_bessel.xsil" expected="photodetector_bessel_expected.xsil" absolute_tolerance="4e-5" relative_tolerance="4e-5" />
  </testing>

  <name>photodetector_bessel</name>
  <author>Graham Dennis</author>
  <description>
    Example poissonian noise simulation
  </description>
  
  <geometry>
    <propagation_dimension> t </propagation_dimension>
    <transverse_dimensions>
        <dimension name="x" domain="(0, 1)" lattice="100" transform="bessel" volume_prefactor="2.0*M_PI" />
    </transverse_dimensions>
  </geometry>

  <noise_vector name="noises" kind="jump" mean-rate="10.0" type="real" method="posix" seed="314 159 276">
      <!-- A mean rate of 10 per volume. This means that over 10 time units and an area of pi * 1^2, we expect 314.15... 
           total events on average -->
        <components>nn</components>
  </noise_vector>
  
  <vector name="main" type="real">
    <components> rho </components>
    <initialisation>
      <![CDATA[
        rho = 0.0;
      ]]>
    </initialisation>
  </vector>
  
  <sequence>
    <integrate algorithm="RK4" interval="10" steps="1000">
      <samples>1000 100</samples>
      <operators>
        <integration_vectors>main</integration_vectors>
        <dependencies>noises</dependencies>
        <![CDATA[
          drho_dt = nn;
        ]]>
      </operators>
    </integrate>
  </sequence>
  <output format="hdf5" filename="photodetector_bessel.xsil">
      <sampling_group basis="x(0)" initial_sample="yes">
        <moments>Ndet</moments>
        <dependencies>main</dependencies>
        <![CDATA[
          Ndet = rho;
        ]]>
      </sampling_group>
      <sampling_group basis="x" initial_sample="yes">
        <moments>dens</moments>
        <dependencies>main</dependencies>
        <![CDATA[
          dens = rho;
        ]]>
      </sampling_group>
  </output>

<info>
Script compiled with XMDS2 version VERSION_PLACEHOLDER (SUBVERSION_REVISION_PLACEHOLDER)
See http://www.xmds.org for more information.
</info>

<XSIL Name="moment_group_1">
  <Param Name="n_independent">1</Param>
  <Array Name="variables" Type="Text">
    <Dim>2</Dim>
    <Stream><Metalink Format="Text" Delimiter=" \n"/>
t Ndet 
    </Stream>
  </Array>
  <Array Name="data" Type="double">
    <Dim>1001</Dim>
    <Dim>2</Dim>
    <Stream><Metalink Format="HDF5" Type="Remote" Group="/1"/>
photodetector_bessel_expected.h5
    </Stream>
  </Array>
</XSIL>

<XSIL Name="moment_group_2">
  <Param Name="n_independent">2</Param>
  <Array Name="variables" Type="Text">
    <Dim>3</Dim>
    <Stream><Metalink Format="Text" Delimiter=" \n"/>
t x dens 
    </Stream>
  </Array>
  <Array Name="data" Type="double">
    <Dim>101</Dim>
    <Dim>100</Dim>
    <Dim>3</Dim>
    <Stream><Metalink Format="HDF5" Type="Remote" Group="/2"/>
photodetector_bessel_expected.h5
    </Stream>
  </Array>
</XSIL>
</simulation>
