This commit is contained in:
voulot_d
2017-06-19 13:30:32 +02:00
parent 060f262a5a
commit 719b4e30ea
3 changed files with 44 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
#Mon Jun 19 11:07:24 CEST 2017
#Mon Jun 19 13:19:05 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=24.0
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-307.51337366396956
spatialCalOffsetY=-328.50773007539067
spatialCalScaleX=-29.549881440739966
spatialCalScaleY=-26.711185419891642
spatialCalOffsetX=447.40694006309144
spatialCalOffsetY=400.8840579710145
spatialCalScaleX=1.0
spatialCalScaleY=1.0
spatialCalUnits=mm
transpose=false

View File

@@ -132,28 +132,31 @@ public class ScreenPanel extends Panel {
double[] getCamtoolDoubleArray(String name) {
return (double[]) Convert.toDouble(((Camtool) camera).getValue(name));
}
class ImageData {
ImageData(){
if (camera instanceof Camtool) {
cache = ((Camtool) camera).getStream().take();
String prefix = goodRegion ? "gr_" : "";
x_fit_mean = getCamtoolDouble(prefix + "x_fit_mean");
y_fit_mean = getCamtoolDouble(prefix + "y_fit_mean");
x_fit_standard_deviation = getCamtoolDouble(prefix + "x_fit_standard_deviation");
y_fit_standard_deviation = getCamtoolDouble(prefix + "y_fit_standard_deviation");
x_fit_gauss_function = getCamtoolDoubleArray(prefix +"x_fit_gauss_function");
y_fit_gauss_function = getCamtoolDoubleArray(prefix +"y_fit_gauss_function");
x_profile = getCamtoolDoubleArray("x_profile");
y_profile = getCamtoolDoubleArray("y_profile");
x_center_of_mass = getCamtoolDouble("x_center_of_mass");
y_center_of_mass = getCamtoolDouble("y_center_of_mass");
x_rms = getCamtoolDouble("x_rms");
y_rms = getCamtoolDouble("y_rms");
x_fit_mean = getDouble(prefix + "x_fit_mean");
y_fit_mean = getDouble(prefix + "y_fit_mean");
x_fit_standard_deviation = getDouble(prefix + "x_fit_standard_deviation");
y_fit_standard_deviation = getDouble(prefix + "y_fit_standard_deviation");
x_fit_gauss_function = getDoubleArray(prefix +"x_fit_gauss_function");
y_fit_gauss_function = getDoubleArray(prefix +"y_fit_gauss_function");
x_profile = getDoubleArray("x_profile");
y_profile = getDoubleArray("y_profile");
x_center_of_mass = getDouble("x_center_of_mass");
y_center_of_mass = getDouble("y_center_of_mass");
x_rms = getDouble("x_rms");
y_rms = getDouble("y_rms");
if (goodRegion){
double[] gX2 = new double[x_profile.length];
Arrays.fill(gX2, Double.NaN);
try{
double x = getCamtoolDoubleArray("gr_x_axis")[0];
double x = getDoubleArray("gr_x_axis")[0];
System.arraycopy(x_fit_gauss_function, 0, gX2, (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageX(x): x), x_fit_gauss_function.length);
} catch (Exception ex){
}
@@ -161,12 +164,12 @@ public class ScreenPanel extends Panel {
double[] gY2 = new double[y_profile.length];
Arrays.fill(gY2, Double.NaN);
try{
double y = getCamtoolDoubleArray("gr_y_axis")[0];
double y = getDoubleArray("gr_y_axis")[0];
System.arraycopy(y_fit_gauss_function, 0, gY2, (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageY(y): y), y_fit_gauss_function.length);
} catch (Exception ex){
}
y_fit_gauss_function = gY2;
}
}
}
}
public Double x_fit_mean;
@@ -180,7 +183,18 @@ public class ScreenPanel extends Panel {
public double[] x_profile;
public double[] x_fit_gauss_function;
public double[] y_profile;
public double[] y_fit_gauss_function;
public double[] y_fit_gauss_function;
StreamValue cache;
Double getDouble(String name) {
return (Double) Convert.toDouble(cache.__getitem__(name));
}
double[] getDoubleArray(String name) {
return (double[]) Convert.toDouble(cache.__getitem__(name));
}
}
class Frame extends ImageData{
@@ -1593,8 +1607,13 @@ public class ScreenPanel extends Panel {
String path = "/data";
String snapshotFile = null;
synchronized (imageBuffer) {
getContext().getDataManager().setDataset(path, renderer.getData().getMatrix(), renderer.getData().isUnsigned());
writeFrameMetadata(path, getCurrentImageData());
ImageData id = getCurrentImageData();
//Object data = renderer.getData().getMatrix();
Object data = Convert.toBidimensional(id.getDoubleArray("image"),
//width & height are not always in the stream
renderer.getData().getWidth(), renderer.getData().getHeight());
getContext().getDataManager().setDataset(path, data, renderer.getData().isUnsigned());
writeFrameMetadata(path, id);
getContext().getDataManager().closeOutput();
//Enforce the same timestamp to data & image files.
snapshotFile = getContext().getSetup().expandPath("{images}/{date}_{time}_snapshot.png", getContext().getExecutionPars().getStart());

View File

@@ -1,8 +1,8 @@
import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = True
do_elog = False
dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
station = "STEST01"