Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CSPad images and tile arangements

Saving data arrays

saving numpy arrays to numpy file

Code Block

import numpy as np

myarray = np.arange(0,100)
np.save( "output_file_name.npy", myarray) 
np.savetxt( "output_file_name.txt", myarray) 

Both of these work with arrays of maximum 2 dimensions.

saving to .mat file (MatLab)

Code Block

import scipy.io 

N_array = np.arange(0,100)
x_array = np.random(100)
y_array = np.random(100)
scipy.io.savemat( "output_file_name.mat", mdict={'N': N_array, 'x' : x_array, 'y' : y_array } )

Interactive analysis with IPython

...

  • The plotting can be done directly in the pyana module, but be aware that you need to disable plotting for the
    module to run successfully in a batch job.
    Code Block
    import matplotlib.pyplot as plt 
    
    plt.plot(array)
    plt.show()
    
  • Or you can load arrays from a file and interactively plot them in iPython. The same ('recommended') syntax as above can be used, or if you use 'import *' you don't need to prepend the commands with the package name, which is handy when plotting interactively:
    Code Block
    
    from matplotlib.pyplot import *
    
    ion()
    plot(array)
    draw()
    

Non-interactive batch analysis

...