diff --git a/plugins/EnergyScan.java b/plugins/EnergyScan.java index eeb2311..f513845 100644 --- a/plugins/EnergyScan.java +++ b/plugins/EnergyScan.java @@ -8,6 +8,7 @@ import ch.psi.pshell.dev.Device; import ch.psi.pshell.dev.DeviceListener; import ch.psi.pshell.epics.ChannelDoubleArray; import ch.psi.pshell.epics.ChannelInteger; +import ch.psi.pshell.epics.Epics; import ch.psi.pshell.plot.LinePlot; import ch.psi.pshell.plot.LinePlotBase; import ch.psi.pshell.plot.LinePlotSeries; @@ -34,7 +35,7 @@ import javax.swing.JPanel; * */ public class EnergyScan extends Panel { - + PluginPanel panel; ChannelDoubleArray data; ChannelDoubleArray edata; @@ -89,6 +90,26 @@ public class EnergyScan extends Panel { evalAsync("caput('START', 'STOP')"); } + void convertFile() throws Exception{ + String cmd = "/sls/X07MA/data/x07maop/bin/modify_otf.pl "; + String folder = "~/Data1/" + ((String) Epics.get("FOLDER", String.class)) + "/"; + String name = ((String) Epics.get("MSG", String.class)).split(" ")[0]; + String sufix = name.substring(name.lastIndexOf("_")+1, name.lastIndexOf(".")); + name = folder + name; + String newName = folder + "/" + Chrono.getTimeStr( scanStartTimestamp, "") + sufix + "0000.txt"; + + cmd += name + " " + newName; + + System.out.println("Converting data file: " + cmd); + Runtime.getRuntime().exec(cmd); + + //~/Data1/2015_06/20150623/23Jun_11_08_Fe_plus.txt + //~/Data1/2015_06/20150623/20150623_1144_Fe_plus_0000.txt + } + + + long scanStartTimestamp; + @Override protected void onExecutedFile(String fileName, Object result){ try { @@ -100,6 +121,7 @@ public class EnergyScan extends Panel { stopScan(); throw ((Exception)result); } + convertFile(); if (batch!=null){ batchIndex++; if (batchIndex>=batch.length){ @@ -354,6 +376,7 @@ public class EnergyScan extends Panel { String folder = expandPath(textFolder.getText()); args.put("FOLDER", folder); + scanStartTimestamp = System.currentTimeMillis(); runAsync("EnergyScan", args); if (scanPlot!=null){ scanPlot.getAxis(Plot.AxisId.X).setRange(Math.min(e1, e2), Math.max(e1, e2));