Пример #1
0
    def testNumpylPowerVsTime(self):
        """ Test export numpy array from the total power as function of time. """
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xs_mf, int0_mean = xfel_photon_analyzer.numpyTotalPower()
Пример #2
0
    def testPlotTotalPowerVsTime(self):
        """ Test plotting the total power as function of time. """
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xfel_photon_analyzer.plotTotalPower()
Пример #3
0
    def testPlotIntensityQMap(self):
        """ Test plotting the intensity map."""
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xfel_photon_analyzer.plotIntensityMap(qspace=True)
Пример #4
0
    def testPlotOnAxisPowerDensityVsEnergy(self):
        """ Test plotting the total power spectrum."""
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xfel_photon_analyzer.plotOnAxisPowerDensity(spectrum=True)
Пример #5
0
    def testPlotOnAxisPowerDensityVsTime(self):
        """ Test plotting the on-axis power as function of time. """
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xfel_photon_analyzer.plotOnAxisPowerDensity()
Пример #6
0
    def testNumpyTotalPowerVsEnergy(self):
        """ Test export numpy array from the total power spectrum."""
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        energy, totalPower = xfel_photon_analyzer.numpyTotalPower(
            spectrum=True)
Пример #7
0
    def testShapedConstruction(self):
        """ Testing the construction of the class with non-default parameters. """

        # Construct the object.
        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        self.assertIsInstance(xfel_photon_analyzer, XFELPhotonAnalysis)
        self.assertIsInstance(xfel_photon_analyzer, AbstractAnalysis)
        self.assertIsInstance(xfel_photon_analyzer, object)

        self.assertIsInstance(xfel_photon_analyzer.wavefront, wpg.Wavefront)
Пример #8
0
    def testMultiplePlots(self):
        """ Check that we can plot multiple times without clashes."""

        xfel_photon_analyzer = XFELPhotonAnalysis(
            input_path=TestUtilities.generateTestFilePath(
                'prop_out_0000001.h5'))

        xfel_photon_analyzer.plotIntensityMap(qspace=False)
        xfel_photon_analyzer.plotIntensityMap(qspace=True)
Пример #9
0
def main(args):

    # Setup the object.
    analyzer = XFELPhotonAnalysis(input_path=args.input_file)

    if args._do_intensity_distribution:
        analyzer.plotIntensityMap(logscale=args.logscale)
    if args._do_qspace_intensity:
        analyzer.plotIntensityMap(logscale=args.logscale, qspace=True)
    if args._do_total_power:
        analyzer.plotTotalPower()
    if args._do_on_axis_power:
        analyzer.plotOnAxisPowerDensity()
    if args._do_spectrum:
        analyzer.plotTotalPower(spectrum=True)
    if args._do_animate:
        analyzer.animate(logscale=args.logscale, qspace=False)

    if not args._do_animate:
        plt.show()