Beispiel #1
0
 def greyscale(self, array2d, **kwargs):
     """
     greyscale(array2d, **kwargs):
         Plot a 2D array as a greyscale image using the same scalings
             as in prepfold.
     """
     # Use the same scaling as in prepfold_plot.c
     global_max = Num.maximum.reduce(Num.maximum.reduce(array2d))
     min_parts = Num.minimum.reduce(array2d, 1)
     array2d = (array2d - min_parts[:, Num.newaxis]) / Num.fabs(global_max)
     Pgplot.plot2d(array2d, image='antigrey', **kwargs)
Beispiel #2
0
def show_ffdot_plane(data,
                     r,
                     z,
                     dr=0.125,
                     dz=0.5,
                     numr=300,
                     numz=300,
                     T=None,
                     contours=None,
                     title=None,
                     image="astro",
                     device="/XWIN",
                     norm=1.0):
    """
    show_ffdot_plane(data, r, z):
        Show a color plot of the F-Fdot plane centered on the point 'r', 'z'.
    """
    ffdp = ffdot_plane(data, r, dr, numr, z, dz, numz)
    ffdpow = spectralpower(ffdp.ravel())
    ffdpow.shape = (numz, numr)
    startbin = int(r - (numr * dr) / 2)
    startz = int(z - (numz * dz) / 2)
    x = np.arange(numr, dtype="d") * dr + startbin
    y = np.arange(numz, dtype="d") * dz + startz
    highpt = np.argmax(ffdpow.ravel())
    hir = highpt % numr
    hiz = highpt / numr
    print("")
    print("Fourier Freqs from ", min(x), "to", max(x), ".")
    print("Fourier Fdots from ", min(y), "to", max(y), ".")
    print("Maximum normalized power is ", ffdpow[hiz][hir])
    print("The max value is located at:  r =", startbin + hir * dr, \
          "  z =", startz + hiz * dz)
    print("")
    if not T:
        Pgplot.plot2d(ffdpow, x, y, labx="Fourier Frequency (bins)", \
                      laby="Fourier Frequency Derivative", \
                      title=title, image=image, \
                      contours=contours, device=device)
    else:
        Pgplot.plot2d(ffdpow, x / T, y / (T ** 2.0), labx="Frequency (hz)", \
                      laby="Frequency Derivative (Hz/sec)", \
                      rangex2=[x[0], x[-1]], rangey2=[y[0], y[-1]], \
                      labx2="Fourier Frequency", \
                      laby2="Fourier Frequency Derivative", \
                      title=title, image=image, \
                      contours=contours, device=device)