Skip to content

Instantly share code, notes, and snippets.

@jrleeman
Created April 15, 2015 12:11
Show Gist options
  • Select an option

  • Save jrleeman/1f52e6ac6c3746b62c9c to your computer and use it in GitHub Desktop.

Select an option

Save jrleeman/1f52e6ac6c3746b62c9c to your computer and use it in GitHub Desktop.
Make pore pressure oscillation control files for the PSU biax.
import numpy as np
import sys
period = input("Period [sec]: ")
n_cycles = input("Number of Cycles: ")
fs = input("Update Rate [Hz]: ")
amp = input("Amplitude [MPa]: ")
print "\n\nCalibrations:\nL: 0.146059 V/MPa\nH: 1.4702 V/MPa\n"
gain = raw_input("[L]ow or [H]igh Gain: ")
if gain == 'L' or gain =='l':
print "Low Gain Set"
calibration = 0.146059
elif gain == 'H' or gain =='h':
print "High Gain Set"
calibration = 1.4702
else:
print "Id10T Error"
sys.exit()
offset_voltage = input("Offset Voltage [V]: ")
outfname = raw_input("File name: ")
zeros = np.zeros((20*fs))
t = np.arange(0,period*n_cycles,1./fs)
y_MPa = amp * np.sin(2*np.pi*(1./period)*t)
y_MPa = np.concatenate((zeros,y_MPa))
y_volts = y_MPa*calibration
t = np.arange(-20,period*n_cycles,1./fs)
y_volts = y_volts + offset_voltage
np.savetxt(outfname,y_volts,fmt='%.6f')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment