Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions java/jscope/src/main/java/mds/jscope/MdsWaveInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ public int mode2DStringToCode(String mode)
return 0;
}

public synchronized void refresh() throws Exception
public void refresh() throws Exception
{
try
{
Expand All @@ -941,7 +941,7 @@ public synchronized void refresh() throws Exception
}
}

public synchronized boolean refreshOnEvent() throws Exception
public boolean refreshOnEvent() throws Exception
{
final long shots[] = GetShots();
if (shots == null)
Expand All @@ -957,7 +957,6 @@ public synchronized boolean refreshOnEvent() throws Exception
{
if (!signals[sigIdx].supportsStreaming() || !signals[sigIdx].updateSignal())
return false;
signals[sigIdx].mergeRegions();
}
}
return true;
Expand Down
11 changes: 11 additions & 0 deletions java/jscope/src/main/java/mds/jscope/jScopeFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,17 @@ private void ToFile(PrintWriter out) throws IOException
}

public void UpdateAllWaves()
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
intUpdateAllWaves();
}
});
}
public void intUpdateAllWaves()
{
final String s = shot_t.getText();
final String s1 = def_values.shot_str;
Expand Down
2 changes: 1 addition & 1 deletion java/jscope/src/main/java/mds/jscope/jScopeMultiWave.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void jScopeErase()
wi.Erase();
}

public synchronized void jScopeWaveUpdate()
public void jScopeWaveUpdate()
{
if (wi.isAddSignal())
{
Expand Down
10 changes: 5 additions & 5 deletions java/jscope/src/main/java/mds/jscope/jScopeWaveContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void AbortUpdate()
abort = true;
}

public synchronized void AddAllEvents(UpdateEventListener l) throws IOException
public void AddAllEvents(UpdateEventListener l) throws IOException
{
jScopeMultiWave w;
if (dp == null)
Expand Down Expand Up @@ -588,7 +588,7 @@ private JFrame GetFrameParent()
return (JFrame) c;
}

public synchronized void getjScopeMultiWave()
public void getjScopeMultiWave()
{
wave_all = new jScopeMultiWave[getGridComponentCount()];
for (int i = 0, k = 0; i < 4; i++)
Expand Down Expand Up @@ -789,7 +789,7 @@ public void processWaveformEvent(WaveformEvent e)
}
}

public synchronized void Refresh(jScopeMultiWave w, String label)
public void Refresh(jScopeMultiWave w, String label)
{
Point p = null;
if (add_sig)
Expand Down Expand Up @@ -1134,7 +1134,7 @@ public void SetMainShot(String shot_str)
{
main_shot_str = null;
main_shot_error = "Main Shots evaluations error : \n" + exc.getMessage();
JOptionPane.showMessageDialog(this, main_shot_error, "alert SetMainShot", JOptionPane.ERROR_MESSAGE);
//JOptionPane.showMessageDialog(this, main_shot_error, "alert SetMainShot", JOptionPane.ERROR_MESSAGE);
}
}
}
Expand Down Expand Up @@ -1302,7 +1302,7 @@ public void ToFile(PrintWriter out, String prompt) throws IOException
}
}

public synchronized void UpdateAllWave() throws Exception
public void UpdateAllWave() throws Exception
{
WaveContainerEvent wce;
try
Expand Down
71 changes: 54 additions & 17 deletions java/jscope/src/main/java/mds/provider/MdsDataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ class SimpleFrameData implements FrameData
private float times[] = null;
private Dimension dim = null;
private int header_size = 0;

public SimpleFrameData(String in_y, String in_x, float time_min, float time_max) throws Exception
{
int i;
Expand Down Expand Up @@ -635,14 +634,14 @@ public XYData getData(double xmin, double xmax, int numPoints, boolean isLong) t
}
else
{
args.addElement(new Descriptor(null, new float[]
{ (float) xmin }));
args.addElement(new Descriptor(null, new float[]
{ (float) xmax }));
args.addElement(new Descriptor(null, new double[]
{ (double) xmin }));
args.addElement(new Descriptor(null, new double[]
{ (double) xmax }));
}
args.addElement(new Descriptor(null, new int[]
{ numPoints }));
byte[] retData;
byte[] retData = null;
int nSamples;
try
{
Expand All @@ -651,11 +650,30 @@ public XYData getData(double xmin, double xmax, int numPoints, boolean isLong) t
if (numPoints == Integer.MAX_VALUE)
throw new Exception("Use Old Method for getting data");
if (isLong)
// retData = GetByteArray(setTimeContext+" MdsMisc->GetXYSignalLongTimes:DSC", args);
retData = GetByteArray(" MdsMisc->GetXYSignalLongTimes:DSC", args);
else
// retData = GetByteArray(setTimeContext+" MdsMisc->GetXYSignal:DSC", args);
retData = GetByteArray(" MdsMisc->GetXYSignal:DSC", args);
{
try {
retData = GetByteArray(" MdsMisc->GetXYSignalDoubleLimits:DSC", args);
}catch(Exception exc)
{
//Try old method in case the mdsip server is not up-to-date
final Vector<Descriptor> newArgs = new Vector<>();
for(int i = 0; i < args.size() - 3; i++)
{
newArgs.addElement(args.elementAt(i));
}
newArgs.addElement(new Descriptor(null, new float[]
{ (float) xmin }));
newArgs.addElement(new Descriptor(null, new float[]
{ (float) xmax }));
newArgs.addElement(new Descriptor(null, new int[]
{ numPoints }));
try {
retData = GetByteArray(" MdsMisc->GetXYSignal:DSC", newArgs);
} catch(Exception exc1){System.out.println(exc1);}
}
}
/*
* Decode data: Format: -retResolution(float) ----Gabriele Feb 2019 NEW: if
* retResolution == 0 then the following int is the number of bytes of the error
Expand Down Expand Up @@ -706,8 +724,14 @@ else if (type == 2) // double X
{
final double[] x = new double[nSamples];
for (int i = 0; i < nSamples; i++)
{
x[i] = dis.readDouble();
res = new XYData(x, y, dRes);
if(i > 0 && x[i-1] > x[i])
{
System.out.println("Internal error: non increasing dimension ("+i+" "+nSamples+")");
}
}
res = new XYData(x, y, dRes);
}
else // float X
{
Expand Down Expand Up @@ -795,17 +819,19 @@ public void getDataAsync(double lowerBound, double upperBound, int numPoints)
@Override
public int getNumDimension() throws IOException
{
if (numDimensions != UNKNOWN)
if (numDimensions != UNKNOWN)
return numDimensions;
String expr;
if (_jscope_set)
expr = "shape(_jscope_" + v_idx + ")";
else
{
if (segmentMode == SEGMENTED_YES)
expr = "shape(GetSegment(" + segmentNodeName + ",0))";
// expr = "shape(GetSegment(" + in_y +",0))";
else
{
expr = "shape("+in_y.replace(segmentNodeName, "GetSegment("+segmentNodeName+",0)")+")";
// expr = "shape(GetSegment(" + segmentNodeName + ",0))";
}
else
{
_jscope_set = true;
expr = "( _jscope_" + v_idx + " = (" + in_y + ";), shape(_jscope_" + v_idx + "))";
Expand Down Expand Up @@ -1106,11 +1132,15 @@ class UpdateDescriptor
this.isXLong = isXLong;
this.updateTime = updateTime;
}
public String toString()
{
return "Lower Bound: "+updateLowerBound+"\nUpper Bound: "+updateUpperBound+"\nupdatePoints: "+updatePoints;
}
}

boolean enabled = true;
Vector<UpdateDescriptor> requestsV = new Vector<>();

UpdateDescriptor currUpdate;
boolean stopWorker = false;

synchronized void enableAsyncUpdate(boolean enabled)
Expand Down Expand Up @@ -1153,10 +1183,14 @@ public void run()
if (!enabled)
break;
// Take most recent request
final UpdateDescriptor currUpdate = requestsV.elementAt(requestsV.size() - 1);
currUpdate = requestsV.elementAt(requestsV.size() - 1);
try
{
requestsV.removeElementAt(requestsV.size() - 1);
//requestsV.clear(); //Older requests are ignored



final XYData currData = currUpdate.simpleWaveData.getData(currUpdate.updateLowerBound,
currUpdate.updateUpperBound, currUpdate.updatePoints, currUpdate.isXLong);
if (debug)
Expand All @@ -1179,6 +1213,8 @@ public void run()
{
final Date d = new Date();
System.out.println(d + " Error in asynchUpdate: " + exc);
System.out.println(currUpdate);
exc.printStackTrace();
}
}
}
Expand Down Expand Up @@ -1376,7 +1412,7 @@ protected synchronized boolean CheckOpen(String experiment, long shot, String de
}
if (open)
{
if (defaultNode != null && (prev_default_node == null || !defaultNode.equals(prev_default_node)))
if (defaultNode != null && (prev_default_node == null || (!defaultNode.trim().equals("") && !defaultNode.equals(prev_default_node))))
{
Descriptor descr;
if (default_node.trim().charAt(0) == '\\')
Expand All @@ -1395,6 +1431,7 @@ else if (defaultNode == null && prev_default_node != null)
mds.MdsValue("TreeSetDefault(\"\\\\::TOP\")");
prev_default_node = null;
}
prev_default_node = default_node;
}
return true;
}
Expand Down
10 changes: 7 additions & 3 deletions java/jscope/src/main/java/mds/wave/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class Grid implements Serializable
*
*/
private static final long serialVersionUID = 1L;
private static final int MAX_STEPS = 1000; //Maximum number of steps in the tick selection agorithm
static final long dayMilliSeconds = 86400000; // 24 * 60 * 60 * 1000;
final static int IS_X = 0, IS_Y = 1;
public final static int IS_DOTTED = 0;
Expand Down Expand Up @@ -64,8 +65,8 @@ public Grid(double xmax, double ymax, double xmin, double ymin, boolean xlog, bo
y_values = new double[50];
this.xmax = xmax;
x_dim = BuildGrid(x_values, IS_X, xmax, ymax, xmin, ymin, xlog, ylog);
y_dim = BuildGrid(y_values, IS_Y, xmax, ymax, xmin, ymin, xlog, ylog);
}
y_dim = BuildGrid(y_values, IS_Y, xmax, ymax, xmin, ymin, xlog, ylog);
}

private int BuildGrid(double val[], int mode, double xmax, double ymax, double xmin, double ymin, boolean xlog,
boolean ylog)
Expand Down Expand Up @@ -125,8 +126,11 @@ private int BuildGrid(double val[], int mode, double xmax, double ymax, double x
curr = (long) (curr_min / step) * step;
if (curr > curr_min)
curr -= (long) ((curr - curr_min) / step) * step;
while (curr >= curr_min)
int maxSteps = MAX_STEPS;
for(int j = 0; j < maxSteps && (curr >= curr_min); j++)
{
curr -= step;
}
for (i = 0; i < 50 && curr < curr_max + step; i++)
{
val[i] = (long) (curr / step + 0.5) * step;
Expand Down
Loading