예제 #1
0
    def plot(self, times=[]):

        style.setStyle()

        self.frequencies.plot()
        style.xlabel("Cyclotron Frequency (kHz)")
        style.ylabel("Entries / 1 kHz")
        plt.savefig(f"{self.directory}/frequencies.pdf")
        plt.close()

        self.profile.plot()
        style.xlabel("Injection Time (ns)")
        style.ylabel("Entries / 1 ns")
        plt.savefig(f"{self.directory}/profile.pdf")
        plt.close()

        self.joint.plot()
        style.xlabel("Injection Time (ns)")
        style.ylabel("Cyclotron Frequency (kHz)")
        plt.savefig(f"{self.directory}/joint.pdf")
        plt.close()

        self.signal.plot()
        style.xlabel(r"Time (ns)")
        style.ylabel("Intensity / 1 ns")
        plt.savefig(f"{self.directory}/signal.pdf")
        for i in range(len(times)):
            if self.backward:
                plt.xlim(-times[i], times[i])
            else:
                plt.xlim(0, times[i])
            plt.savefig(f"{self.directory}/signal_{i}.pdf")
        plt.close()
예제 #2
0
from gm2fr.simulation.mixture import GaussianMixture
from gm2fr.simulation.simulator import Simulator
import gm2fr.utilities as util

import matplotlib.pyplot as plt
import gm2fr.style as style

style.setStyle()

# Create a Gaussian mixture distribution for the muon revolution frequencies.
# This is a probability distribution modeled as a sum of individual Gaussians.
# This allows us to model interesting and asymmetric distributions for testing.
# Each Gaussian has a relative weight (i.e. scale/amplitude), mean, and width.
# Input format is a list for each parameter.
# Reference: magic frequency is 6705 kHz, with spread about ~10 kHz.
# For this example, I'll keep it simple, to check the analysis results.
frequency = GaussianMixture(weights=[1], means=[6705], widths=[8.5])

# Create a Gaussian mixture distribution for the injection time profile, in ns.
# Same format as above.
# Reference: generally centered near zero, with spread about ~30 ns.
# Realistic profiles often contain 3+ peaks, with 2 on either side of zero.
injection = GaussianMixture(
    # weights = [1, 0.5, 0.3],
    # means = [0, 30, -20],
    # widths = [25, 15, 15]
    weights=[1],
    means=[0],
    widths=[25])

# To model a toy correlation between frequency and injection time, we can define a function which