PSSS improvements
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#Sun May 02 17:34:36 CEST 2021
|
||||
#Tue May 04 13:01:49 CEST 2021
|
||||
\u0000\u0000\u0000\u0000=
|
||||
=0
|
||||
spatialCalOffsetY=-92.49729632739741
|
||||
spatialCalOffsetX=-96.48730927109395
|
||||
spatialCalOffsetY=0.0
|
||||
spatialCalOffsetX=0.0
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=-13.33686325150698
|
||||
spatialCalScaleY=-11.627907252956081
|
||||
colormapMax=81.0
|
||||
spatialCalScaleX=-1.0
|
||||
spatialCalScaleY=-1.0
|
||||
colormapMax=15848.0
|
||||
Y=0
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Temperature
|
||||
imageWidth=1280
|
||||
invert=false
|
||||
colormapMin=0.0
|
||||
colormapMin=69.0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
@@ -24,7 +24,7 @@ spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=true
|
||||
colormapAutomatic=false
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import ch.psi.pshell.bs.PipelineServer;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.epics.ChannelDouble;
|
||||
import ch.psi.pshell.imaging.RendererMode;
|
||||
import ch.psi.pshell.plot.Plot;
|
||||
import ch.psi.pshell.plot.LinePlotJFree;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.Convert;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.Str;
|
||||
import java.awt.CardLayout;
|
||||
@@ -51,6 +53,16 @@ public class PSSS extends Panel {
|
||||
|
||||
spinnerAverage.setValue(( (Number) eval("get_psss_averaging()", true)).intValue());
|
||||
|
||||
try{
|
||||
Double energy = (((ChannelDouble)getDevice("energy_machine")).take(-1));
|
||||
energy=Convert.roundDouble(energy, 0);
|
||||
spFromEn.setValue(energy-150);
|
||||
spToEn.setValue(energy+150);
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,10 @@ if get_exec_pars().source == CommandSource.ui:
|
||||
PLOT=None
|
||||
p = plot(None, title="Data")[0] if (PLOT is None) else PLOT
|
||||
p.clear()
|
||||
p.removeMarker(None)
|
||||
p.setLegendVisible(True)
|
||||
p.addSeries(LinePlotSeries("PSSS Spectrum Average"))
|
||||
|
||||
|
||||
run("cpython/wrapper")
|
||||
|
||||
@@ -25,8 +28,13 @@ av = create_averager(psss_spectrum_y, NUM_SHOTS, interval=-1, name="spectrum_ave
|
||||
av_samples = av.samples
|
||||
av_samples.alias = "spectrum_samples"
|
||||
|
||||
|
||||
#Scan and take data
|
||||
r = lscan(cam_x, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=0.0, save=False )
|
||||
def after_read(record, scan):
|
||||
p.getSeries(0).setData(psss_spectrum_x.take(), record[av])
|
||||
p.setTitle("Cam X = %1.3f" %(record[cam_x]))
|
||||
|
||||
r = lscan(cam_x, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=0.0, after_read = after_read, save=False)
|
||||
average, samples, cam_range = r.getReadable(0), r.getReadable(1), r.getPositions(0)
|
||||
|
||||
signal_centre, projection = get_signal_centre(samples, cam_range)
|
||||
@@ -56,6 +64,8 @@ plt.grid(True)
|
||||
#plot_data(PLOT, projection, "Data", xdata=cam_range, show_points = True, color=Color.BLUE)
|
||||
#p,pars = plot_gauss_fit(cam_range, projection, gauss_pars=None, p=PLOT, title = "Data")
|
||||
|
||||
p.clear()
|
||||
p.setTitle("")
|
||||
plot_data(p, projection, "Projection", xdata=cam_range, show_points = True, color=Color.BLUE)
|
||||
p.addMarker(signal_centre, None, "Signal Centre=" + str(round(signal_centre,2)), Color.LIGHT_GRAY)
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ if get_exec_pars().source == CommandSource.ui:
|
||||
NUM_SHOTS= 10 # 100
|
||||
PLOT=None
|
||||
|
||||
if PLOT:
|
||||
PLOT.clear()
|
||||
|
||||
p = plot(None, title="Data")[0] if (PLOT is None) else PLOT
|
||||
p.clear()
|
||||
p.removeMarker(None)
|
||||
p.setLegendVisible(True)
|
||||
p.addSeries(LinePlotSeries("PSSS Spectrum Average"))
|
||||
|
||||
run("cpython/wrapper")
|
||||
|
||||
@@ -27,9 +29,14 @@ else:
|
||||
av = create_averager(psss_spectrum_y, NUM_SHOTS, interval=-1, name="spectrum_average")
|
||||
av_samples = av.samples
|
||||
av_samples.alias = "spectrum_samples"
|
||||
|
||||
|
||||
#Scan and take data
|
||||
r = lscan(xstal_height, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=2.0, save=False )
|
||||
def after_read(record, scan):
|
||||
p.getSeries(0).setData(psss_spectrum_x.take(), record[av])
|
||||
p.setTitle("Xtal Height = %1.3f" %(record[xstal_height]))
|
||||
|
||||
r = lscan(xstal_height, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=2.0, after_read = after_read, save=False)
|
||||
|
||||
#User inputs - define travel range of crystal
|
||||
#It is unlikely these values need to be changed
|
||||
average, samples, xstal_range = r.getReadable(0), r.getReadable(1), r.getPositions(0)
|
||||
@@ -66,7 +73,9 @@ plt.xticks([])
|
||||
plt.legend()
|
||||
plt.grid(True)
|
||||
"""
|
||||
plot_gauss_fit(xstal_range, projection, gauss_pars=(offset, amp, mean_val, sigma), p=PLOT, title = "Data")
|
||||
p.clear()
|
||||
p.setTitle("")
|
||||
plot_gauss_fit(xstal_range, projection, gauss_pars=(offset, amp, mean_val, sigma), p=p, title = "Data")
|
||||
|
||||
|
||||
set_return(mean_val)
|
||||
|
||||
@@ -14,6 +14,11 @@ if get_exec_pars().source == CommandSource.ui:
|
||||
STEPS = 5 #60
|
||||
NUM_SHOTS= 10 #100
|
||||
PLOT=None
|
||||
p = plot(None, title="Data")[0] if (PLOT is None) else PLOT
|
||||
p.clear()
|
||||
p.removeMarker(None)
|
||||
p.setLegendVisible(True)
|
||||
p.addSeries(LinePlotSeries("PSSS Spectrum Average"))
|
||||
|
||||
if RANGE_OFF is not None:
|
||||
RANGE_FROM = energy_machine.read()-RANGE_OFF
|
||||
@@ -21,8 +26,7 @@ if RANGE_OFF is not None:
|
||||
|
||||
run("cpython/wrapper")
|
||||
|
||||
if PLOT:
|
||||
PLOT.clear()
|
||||
|
||||
|
||||
|
||||
#Scan and take data
|
||||
@@ -41,8 +45,13 @@ en.alias = "energy"
|
||||
av = create_averager(psss_spectrum_y, NUM_SHOTS, interval=-1, name="spectrum_average")
|
||||
av_samples = av.samples
|
||||
av_samples.alias = "spectrum_samples"
|
||||
|
||||
r = lscan(en, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=0.0, save=False )
|
||||
|
||||
|
||||
def after_read(record, scan):
|
||||
p.getSeries(0).setData(psss_spectrum_x.take(), record[av])
|
||||
p.setTitle("Energy = %1.3f" %(record[en]))
|
||||
|
||||
r = lscan(en, (av, av_samples), RANGE_FROM, RANGE_TO, STEPS, latency=0.0, after_read = after_read, save=False )
|
||||
average, samples, energy_range = r.getReadable(0), r.getReadable(1), r.getPositions(0)
|
||||
|
||||
[amp, mean_val, sigma, offset],centre_line_out = fit_energy(RANGE_FROM, RANGE_TO, STEPS+1, NUM_SHOTS, samples)
|
||||
@@ -77,6 +86,9 @@ plt.xticks([])
|
||||
plt.legend()
|
||||
plt.grid(True)
|
||||
"""
|
||||
|
||||
p.clear()
|
||||
p.setTitle("")
|
||||
plot_gauss_fit(energy_range, centre_line_out, gauss_pars=(offset, amp, mean_val, sigma), p=PLOT, title = "Data")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user