d_pd = Fundation.PositioningDirectives(
                        ReferTo = 'upstream',
                        PlaceWhat = 'centre',
                        PlaceWhere = 'downstream focus',
                        Distance = 0)
    d = OpticalElement(
                        d_k, 
                        PositioningDirectives = d_pd, 
                        Name = 'detector')
    d.ComputationSettings.UseCustomSampling = UseCustomSampling 
    d.ComputationSettings.NSamples = N                          # come sopra. In teoria il campionamento può essere specificato elemento per elmeento
    

    # Assemblamento beamline
    #==========================================================================
    t = Fundation.BeamlineElements()
    t.Append(s)
    t.Append(pm1a)         # per ora lo lasciamo commentato, devo aggiustare una cosa che si è rotta 2 gg fa
    t.RefreshPositions()

    t.ComputationSettings.NPools = 5
    t.ComputeFields(oeStart=s, oeEnd=pm1a, Verbose = False)

    if not pm1a.ComputationSettings.Ignore: plot(pm1a, 11)

    t.Append(pm1b)         # per ora lo lasciamo commentato, devo aggiustare una cosa che si è rotta 2 gg fa
    t.RefreshPositions()

    t.ComputationSettings.NPools = 5
    t.ComputeFields(oeStart=pm1a, oeEnd=pm1b, Verbose = False)
    def __init__(self):
        super(WisePropagationElements, self).__init__()

        self.__wise_propagation_elements = Fundation.BeamlineElements()