This commit is contained in:
voulot_d
2017-06-02 17:03:41 +02:00
parent c6a20f54f2
commit 0720a1e5f2
7 changed files with 62 additions and 23 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
#Fri Jun 02 16:04:33 CEST 2017
#Fri Jun 02 16:57:43 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=7000.0
colormapMax=1000.0
colormapMin=10.0
flipHorizontally=false
flipVertically=false
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-308.5490134010733
spatialCalOffsetY=-258.50687675129035
spatialCalScaleX=-7.72640887853721
spatialCalScaleY=-7.804878159918345
spatialCalOffsetX=-158.5197404227148
spatialCalOffsetY=-106.41406334370838
spatialCalScaleX=-14.401765522203947
spatialCalScaleY=-13.617021560668945
spatialCalUnits=mm
transpose=false
+3 -3
View File
@@ -1,12 +1,12 @@
#Fri Jun 02 16:15:44 CEST 2017
#Fri Jun 02 16:31:12 CEST 2017
defaultSpeed=6000.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=8000.0
maxValue=51500.0
maxValue=64000.0
minSpeed=50.0
minValue=-56789.2
minValue=-48153.0
offset=0.0
precision=1
resolution=0.1
+40 -7
View File
@@ -129,6 +129,10 @@ public class ScreenPanel extends Panel {
yMean = getCamtoolDouble("y_fit_mean");
xSigma = getCamtoolDouble("x_fit_standard_deviation");
ySigma = getCamtoolDouble("y_fit_standard_deviation");
xCom = getCamtoolDouble("x_center_of_mass");
yCom = getCamtoolDouble("y_center_of_mass");
xRms = getCamtoolDouble("x_rms");
yRms = getCamtoolDouble("y_rms");
x_profile = getCamtoolDoubleArray("x_profile");
x_fit_gauss_function = getCamtoolDoubleArray("x_fit_gauss_function");
y_profile = getCamtoolDoubleArray("y_profile");
@@ -138,8 +142,12 @@ public class ScreenPanel extends Panel {
Data data;
Double xMean;
Double yMean;
Double xCom;
Double xRms;
Double xSigma;
Double ySigma;
Double yCom;
Double yRms;
double[] x_profile;
double[] x_fit_gauss_function;
double[] y_profile;
@@ -928,8 +936,8 @@ public class ScreenPanel extends Panel {
Overlays.Polyline vgaussian = null;
Overlays.Polyline hprofile = null;
Overlays.Polyline vprofile = null;
Double xMean = null, xSigma = null, xNorm = null;
Double yMean = null, ySigma = null, yNorm = null;
Double xMean = null, xSigma = null, xNorm = null, xCom = null, xRms = null;
Double yMean = null, ySigma = null, yNorm = null, yCom = null, yRms = null;
double[] pX = null, pY = null, gX = null, gY = null;
int height = data.getHeight();
int width = data.getWidth();
@@ -950,6 +958,10 @@ public class ScreenPanel extends Panel {
gX = f.x_fit_gauss_function;
pY = f.y_profile;
gY = f.y_fit_gauss_function;
xCom = f.xCom;
xRms = f.xRms;
yCom = f.yCom;
yRms = f.yRms;
}
}
}
@@ -958,6 +970,10 @@ public class ScreenPanel extends Panel {
yMean = getCamtoolDouble("y_fit_mean");
xSigma = getCamtoolDouble("x_fit_standard_deviation");
ySigma = getCamtoolDouble("y_fit_standard_deviation");
xCom = getCamtoolDouble("x_center_of_mass");
yCom = getCamtoolDouble("y_center_of_mass");
xRms = getCamtoolDouble("x_rms");
yRms = getCamtoolDouble("y_rms");
pX = getCamtoolDoubleArray("x_profile");
gX = getCamtoolDoubleArray("x_fit_gauss_function");
pY = getCamtoolDoubleArray("y_profile");
@@ -1104,15 +1120,15 @@ public class ScreenPanel extends Panel {
}
Overlays.Crosshairs cross = null;
Overlays.Text text = null;
Overlays.Text textFit = null;
if ((xMean != null) && (yMean != null)) {
text = new Overlays.Text(penFit,
textFit = new Overlays.Text(penFit,
String.format("x: m=%1.3f \u03C3=%1.3f\ny: m=%1.3f \u03C3=%1.3f",
xMean, xSigma,
yMean, ySigma),
new Font(Font.MONOSPACED, 0, 14), new Point(20, 20));
text.setFixed(true);
text.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
textFit.setFixed(true);
textFit.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
Point center = new Point(xMean.intValue(), yMean.intValue());
if (renderer.getCalibration() != null) {
@@ -1122,7 +1138,24 @@ public class ScreenPanel extends Panel {
}
cross = new Overlays.Crosshairs(penCross, center, new Dimension(Math.abs(2 * xSigma.intValue()), 2 * Math.abs(ySigma.intValue())));
}
return new Overlay[]{hprofile, vprofile, hgaussian, vgaussian, cross, text};
if ((xCom != null) && (yCom != null)) {
textFit = new Overlays.Text(penFit,
String.format("x: m=%1.3f \u03C3=%1.3f\ny: m=%1.3f \u03C3=%1.3f",
xMean, xSigma,
yMean, ySigma),
new Font(Font.MONOSPACED, 0, 14), new Point(20, 20));
textFit.setFixed(true);
textFit.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
Point center = new Point(xMean.intValue(), yMean.intValue());
if (renderer.getCalibration() != null) {
center = renderer.getCalibration().convertToImagePosition(new PointDouble(xMean, yMean));
xSigma /= renderer.getCalibration().getScaleX();
ySigma /= renderer.getCalibration().getScaleY();
}
cross = new Overlays.Crosshairs(penCross, center, new Dimension(Math.abs(2 * xSigma.intValue()), 2 * Math.abs(ySigma.intValue())));
}
return new Overlay[]{hprofile, vprofile, hgaussian, vgaussian, cross, textFit};
}
return null;
}
+1 -1
View File
@@ -161,7 +161,7 @@ class WireScanner(WireScanInfo):
def wait_in_selection(self):
time.sleep(0.5) #Some time for the status change
scanner.waitValue("At start", 60000)
self.waitValue("At start", 60000)
def scan(self):
self.cycles = self.nb_cycles.get()
+4 -2
View File
@@ -46,17 +46,19 @@ def after(rec):
caput(station + "-RSYS:GET-ENERGY-ARRAY", to_array(arr_energy,'d'))
try:
xb = create_averager(x, nb, 0.100)
r = lscan(phase, xb, start, stop, step, latency=lat, after_read = after)
x_averager = create_averager(x, nb, 0.100)
r = lscan(phase, x_averager, start, stop, step, latency=lat, after_read = after)
rf_phase = r.getPositions(0)
energy = [val.mean/1000.0/disp*energy0 for val in r.getReadable(0)]
caput(station + "-RSYS:GET-ENERGY-ARRAY", to_array(energy, 'd'))
caput(station + "-RSYS:GET-PHASE-ARRAY", to_array(rf_phase,'d'))
try:
#(energy_max, angular_frequency, phase0, in_range, phase_fit_max, fit_x, fit_y) = hfit(energy , xdata = rf_phase)
run("CPython/wrapper")
(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(energy , rf_phase)
except:
raise Exception("Fit failure")
plot([energy, fit_y], ["data", "fit"], [rf_phase, fit_x])
energy_max = fit_amplitude - fit_offset
caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", ph_crest)
caput(station + "-RSYS:GET-ONCREST-E-GAIN", energy_max)
+6 -3
View File
@@ -3,7 +3,7 @@ run("Devices/WireScanner")
#devices = [ "S30CB09-DWSC440"]
#devices = ["S20SY03-DWSC090"]
devices = ["S20SY03-DWSC090", "S30CB09-DWSC440"]
devices = ["S30CB09-DWSC440", "S20SY03-DWSC090"]
scanners = []
@@ -25,9 +25,12 @@ for scanner in scanners:
scanner.init(wait=False)
bscan(st, 650)
scanners[0].wait_in_selection()
for scanner in scanners:
scanner.park(wait=False)
bscan(st, 650, title = "Back")
for scanner in scanners:
scanner.wait_in_selection()
scanners[0].wait_in_selection()
+2 -1
View File
@@ -9,4 +9,5 @@ x = [ 50.0, 51.05263158, 52.10526316, 53.15789474, 54.21052632, \
65.78947368, 66.84210526, 67.89473684, 68.94736842, 70. ]
r = hfitoff(y, x)
plot([y,r[5]], ["data", "fit"], [x, r[4]])
#plot([y,r[5]], ["data", "fit"], [x, r[4]])
plot([y,r[5]], [x, r[4]])