Skip to content
Snippets Groups Projects
Commit 675f9cb0 authored by U-awa3\awa's avatar U-awa3\awa
Browse files

new ESSPSCtrl scripts -- scanCoil.py

parent 5ed431ad
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 26 09:20:05 2022
@author: awa
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 8 22:53:55 2020
@author: AWA
"""
import sys
sys.path.insert(0, 'F:\\2022\\pyctrl-awa\\base\\')
from interface import AWAInterface
import numpy as np
import matplotlib.pyplot as plt
from epics import caget, caput
import time
#from ESSPSCtrl import *
screen = AWAInterface()
#S*Vdddd=Set scaling voltage to dddd Volts
#S*Cdddd=Set Scaling current to dddd Amps
#?M returns mode, SN, etc
#SR put the supply in REMOTE operating mode
#PC%## to set the current output to ##% of full scale
#PV%## to set the voltage output to ##% of full scale
#MV measure the voltage output
#MC measure the current output
N = 20
nshots = 5
currents = np.linspace(0,195,N)
tstamp=time.strftime("%Y%m%d-%H%M%S")
filename = 'JlabCoilScan'+tstamp
CentroidX = np.zeros((N))
CentroidY = np.zeros((N))
dCentroidX = np.zeros((N))
dCentroidY = np.zeros((N))
CoilValues = np.zeros((N))
for i in range(N):
SetCurrent(currents[i])
time.sleep(1.0)
_, sdata, roi = screen.get_data(n_samples=nshots, charge_deviation=0.3, stat=True)
# _, sdata, roi = screen.save_data(filename, target_charge=Charge,
# charge_deviation=0.3, # within +/- 10% deviation
# n_samples=nshots, stat=True) # Number of samples
CentroidX[i] = np.mean(sdata[:,3])
CentroidY[i] = np.mean(sdata[:,4])
dCentroidX[i] = np.std(sdata[:,3])
dCentroidY[i] = np.std(sdata[:,4])
time.sleep(0.5)
np.savez(filename,dipole= currents,cenx=CentroidX,dcenx=dCentroidX,ceny=CentroidY, dceny=dCentroidY)
print(filename)
......@@ -11,6 +11,7 @@ import ```./base/interface.py ``` in your script. you can then use various comm
- [ ] aiml: scripts to vary parameters
- [ ] base: scripts to perform basic operation and talk to devices (stepper motors, camera, power supply). Currenly, the protocop use are EPICS (when available) and TCP (for AWA legacy system)
- [ ] ESSPSCtrl: control for ESS power supply (currently 12/09 conencted to JLab coil)
- [ ] camera: scripts to acquire data from CCD camera (example from the NI frame grabber, and Point Grey camera). Not the radCAM need further work.
- [ ] laser: scripts to controls laser devices (e.g. alpha-BBO Xtal, and lambda/2 polarizer)
- [ ] legacy_scripts: old scripts based on the legacy AWA control system
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment