Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd0a6aa

Browse filesBrowse files
committed
General usability changes
- Fixed sample name parsing in Netzsch files - Made some changes to the text displayed in the GUI - Tooltips now more informative and well-formatted - Added missing SwingUtilities.invokeLater(…) method when updating graphical logs - Added safety checks for graphical logging - Added ‘finished’ boolean in the Log class, which helps graphical logs to be displayed correctly - Migrated to JfreeChart 1.5.4, which fixes issues with graphs in resized windows - Switched from using ExecutionServices and ForkJoinPools to using CompletableFutures. Removed redundant blocks where concurrency has been poorly handled. - Removed argument from checkProblems() in SearchTask - Fixed execution of queued tasks hanging because of conflicting ForkJoinPools - Fixed tracker dialogs not closing on end of scheme selection - Fixed focus lost problem in ProblemStatementFrame
1 parent f72862b commit dd0a6aa
Copy full SHA for dd0a6aa
Expand file treeCollapse file tree

26 files changed

+293
-306
lines changed

‎pom.xml

Copy file name to clipboardExpand all lines: pom.xml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>kotik-coder</groupId>
55
<artifactId>PULsE</artifactId>
6-
<version>1.97b</version>
6+
<version>1.97c</version>
77
<name>PULsE</name>
88
<description>Processing Unit for Laser flash Experiments</description>
99
<developers>
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>org.jfree</groupId>
2525
<artifactId>jfreechart</artifactId>
26-
<version>1.5.0</version>
26+
<version>1.5.4</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.formdev</groupId>

‎src/main/java/pulse/input/Metadata.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/input/Metadata.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class Metadata extends PropertyHolder implements Reflexive {
6161
* experimental setup.
6262
*/
6363
public Metadata(NumericProperty temperature, int externalId) {
64-
sampleName = new SampleName();
64+
sampleName = new SampleName(null);
6565
setExternalID(externalId);
6666
pulseDescriptor.setSelectedDescriptor(RectangularPulse.class.getSimpleName());
6767
data = new TreeSet<>();
@@ -186,7 +186,7 @@ public void set(NumericPropertyKeyword type, NumericProperty property) {
186186
@Override
187187
public List<Property> listedTypes() {
188188
List<Property> list = super.listedTypes();
189-
list.add(new SampleName());
189+
list.add(new SampleName(""));
190190
list.add(pulseDescriptor);
191191
return list;
192192
}

‎src/main/java/pulse/io/readers/NetzschCSVReader.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/io/readers/NetzschCSVReader.java
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import pulse.input.Metadata;
2424
import pulse.input.Range;
2525
import pulse.properties.NumericPropertyKeyword;
26+
import pulse.properties.SampleName;
2627
import pulse.ui.Messages;
2728

2829
/**
@@ -49,6 +50,7 @@ public class NetzschCSVReader implements CurveReader {
4950
private final static String DIAMETER = "Diameter";
5051
private final static String L_PULSE_WIDTH = "Laser_pulse_width";
5152
private final static String PULSE_WIDTH = "Pulse_width";
53+
private final static String MATERIAL = "Material";
5254

5355
/**
5456
* Note comma is included as a delimiter character here.
@@ -115,6 +117,9 @@ public List<ExperimentalData> read(File file) throws IOException {
115117

116118
int shotId = determineShotID(reader, file);
117119

120+
String name = findLineByLabel(reader, MATERIAL, DETECTOR_SPOT_SIZE, true)
121+
.substring(MATERIAL.length() + 1)
122+
.replaceAll(delims, "");
118123
String spot = findLineByLabel(reader, DETECTOR_SPOT_SIZE, THICKNESS, false);
119124

120125
double spotSize = 0;
@@ -164,6 +169,7 @@ public List<ExperimentalData> read(File file) throws IOException {
164169
if (pulseWidth > 1e-10) {
165170
met.set(NumericPropertyKeyword.PULSE_WIDTH, derive(NumericPropertyKeyword.PULSE_WIDTH, pulseWidth));
166171
}
172+
met.setSampleName(new SampleName(name));
167173
met.set(NumericPropertyKeyword.THICKNESS, derive(NumericPropertyKeyword.THICKNESS, thickness));
168174
met.set(NumericPropertyKeyword.DIAMETER, derive(NumericPropertyKeyword.DIAMETER, diameter));
169175
met.set(NumericPropertyKeyword.FOV_OUTER, derive(NumericPropertyKeyword.FOV_OUTER, spotSize != 0 ? spotSize : 0.85 * diameter));

‎src/main/java/pulse/problem/schemes/Grid.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/problem/schemes/Grid.java
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,9 @@ public final double gridAxialDistance(double distance, double lengthFactor) {
211211

212212
@Override
213213
public String toString() {
214-
var sb = new StringBuilder();
215-
sb.append("<html>").
216-
append(getClass().getSimpleName())
217-
.append(": <math><i>h<sub>x</sub></i>=")
218-
.append(format("%3.2e", hx))
219-
.append("; ").
220-
append("<i>&tau;</i>=")
221-
.append(format("%3.2e", tau))
222-
.append("; ");
214+
var sb = new StringBuilder("Grid");
215+
sb.append(String.format("%n %-25s", this.getGridDensity()));
216+
sb.append(String.format("%n %-25s", this.getTimeFactor()));
223217
return sb.toString();
224218
}
225219

‎src/main/java/pulse/problem/schemes/Grid2D.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/problem/schemes/Grid2D.java
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ public double gridRadialDistance(double radial, double lengthFactor) {
9999
return rint((radial / lengthFactor) / hy) * hy;
100100
}
101101

102-
@Override
103-
public String toString() {
104-
return super.toString() + "<math><i>h<sub>y</sub></i>=" + format("%3.3f", hy);
105-
}
106-
107102
public double getYStep() {
108103
return hy;
109104
}

‎src/main/java/pulse/problem/statements/Pulse.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/problem/statements/Pulse.java
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,10 @@ public void setLaserEnergy(NumericProperty laserEnergy) {
163163

164164
@Override
165165
public String toString() {
166-
StringBuilder sb = new StringBuilder();
167-
sb.append(getPulseShape());
168-
sb.append(" ; ");
169-
sb.append(getPulseWidth());
170-
sb.append(" ; ");
171-
sb.append(getLaserEnergy());
166+
StringBuilder sb = new StringBuilder("Pulse:");
167+
sb.append(String.format("%n %-25s", getPulseShape()));
168+
sb.append(String.format("%n %-25s", getPulseWidth()));
169+
sb.append(String.format("%n %-25s", getLaserEnergy()));
172170
return sb.toString();
173171
}
174172

‎src/main/java/pulse/problem/statements/Pulse2D.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/problem/statements/Pulse2D.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public void setSpotDiameter(NumericProperty spotDiameter) {
6060
@Override
6161
public String toString() {
6262
StringBuilder sb = new StringBuilder(super.toString());
63-
sb.append(" ; ");
64-
sb.append(getSpotDiameter());
63+
sb.append(String.format("%n %-25s", getSpotDiameter()));
6564
return sb.toString();
6665
}
6766

‎src/main/java/pulse/problem/statements/model/AbsorptionModel.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/problem/statements/model/AbsorptionModel.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ public void set(NumericPropertyKeyword type, NumericProperty property) {
9595

9696
@Override
9797
public String toString() {
98-
return getClass().getSimpleName() + " : " + absorptionMap.get(LASER) + " ; " + absorptionMap.get(THERMAL);
98+
var sb = new StringBuilder(getSimpleName());
99+
sb.append(String.format("%n %-25s", absorptionMap.get(LASER)));
100+
sb.append(String.format("%n %-25s", absorptionMap.get(THERMAL)));
101+
return sb.toString();
99102
}
100103

101104
@Override

‎src/main/java/pulse/properties/SampleName.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/properties/SampleName.java
+20-14Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ public class SampleName implements Property {
66

77
private String name;
88

9-
public SampleName() {
10-
//null name
9+
public SampleName(String name) {
10+
this.name = name;
1111
}
1212

1313
@Override
@@ -41,22 +41,28 @@ public String toString() {
4141
}
4242

4343
@Override
44-
public boolean equals(Object o) {
45-
if (o == this) {
44+
public int hashCode() {
45+
int hash = 5;
46+
hash = 43 * hash + Objects.hashCode(this.name);
47+
return hash;
48+
}
49+
50+
@Override
51+
public boolean equals(Object obj) {
52+
if (this == obj) {
4653
return true;
4754
}
48-
49-
if (o == null) {
55+
if (obj == null) {
5056
return false;
5157
}
52-
53-
boolean result = false;
54-
55-
if (o instanceof SampleName) {
56-
result = name.equals(((SampleName) o).getValue());
58+
if (getClass() != obj.getClass()) {
59+
return false;
5760
}
58-
59-
return result;
61+
final SampleName other = (SampleName) obj;
62+
if (!Objects.equals(this.name, other.name)) {
63+
return false;
64+
}
65+
return true;
6066
}
6167

62-
}
68+
}

‎src/main/java/pulse/search/direction/LMOptimiser.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/search/direction/LMOptimiser.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class LMOptimiser extends GradientBasedOptimiser {
4343
* Up to {@value MAX_FAILED_ATTEMPTS} failed attempts are allowed.
4444
*/
4545

46-
public final static int MAX_FAILED_ATTEMPTS = 4;
46+
public final static int MAX_FAILED_ATTEMPTS = 5;
4747

4848
private LMOptimiser() {
4949
super();

‎src/main/java/pulse/tasks/Calculation.java

Copy file name to clipboardExpand all lines: src/main/java/pulse/tasks/Calculation.java
+39-31Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@ public Calculation(Calculation c) {
7979
}
8080
instanceDescriptor.addListener(() -> initModelCriterion(rs));
8181
}
82-
82+
8383
public void conformTo(UpwardsNavigable owner) {
8484
problem.setParent(owner);
8585
scheme.setParent(owner);
8686
rs.setParent(owner);
8787
os.setParent(owner);
8888
result.setParent(owner);
8989
}
90-
90+
9191
public void clear() {
9292
this.status = INCOMPLETE;
9393
this.problem = null;
9494
this.scheme = null;
9595
}
96-
96+
9797
/**
9898
* <p>
9999
* After setting and adopting the {@code problem} by this
@@ -201,31 +201,40 @@ public Status getStatus() {
201201
*/
202202
public boolean setStatus(Status status) {
203203

204-
boolean changeStatus = true;
205-
206-
switch (this.status) {
207-
case QUEUED:
208-
case IN_PROGRESS:
209-
switch (status) {
210-
case QUEUED:
211-
case READY:
212-
case INCOMPLETE:
213-
changeStatus = false;
214-
break;
215-
default:
216-
}
217-
break;
218-
case FAILED:
219-
case EXECUTION_ERROR:
220-
case INCOMPLETE:
221-
//if the TaskManager attempts to run this calculation
222-
changeStatus = status != Status.QUEUED;
223-
break;
224-
default:
225-
}
204+
boolean changeStatus = false;
205+
206+
if (this.getStatus() != status) {
207+
208+
changeStatus = true;
209+
210+
//current status is given by ** this.status **
211+
//new status is the ** argument ** of this method
212+
switch (this.status) {
213+
case QUEUED:
214+
//do not change status to queued, ready or incomplete if already in progress
215+
case IN_PROGRESS:
216+
switch (status) {
217+
case QUEUED:
218+
case READY:
219+
case INCOMPLETE:
220+
changeStatus = false;
221+
break;
222+
default:
223+
}
224+
break;
225+
case FAILED:
226+
case EXECUTION_ERROR:
227+
case INCOMPLETE:
228+
//if the TaskManager attempts to run this calculation
229+
changeStatus = status != Status.QUEUED;
230+
break;
231+
default:
232+
}
233+
234+
if (changeStatus) {
235+
this.status = status;
236+
}
226237

227-
if (changeStatus) {
228-
this.status = status;
229238
}
230239

231240
return changeStatus;
@@ -350,14 +359,14 @@ public void setResult(Result result) {
350359
public double evaluate(double t) {
351360
return problem.getHeatingCurve().interpolateSignalAt(t);
352361
}
353-
362+
354363
@Override
355364
public Segment accessibleRange() {
356365
var hc = problem.getHeatingCurve();
357366
return new Segment(hc.timeAt(0), hc.timeLimit());
358367
}
359368

360-
/**
369+
/**
361370
* This will use the current {@code DifferenceScheme} to solve the
362371
* {@code Problem} for this {@code SearchTask} and calculate the SSR value
363372
* showing how well (or bad) the calculated solution describes the
@@ -367,7 +376,6 @@ public Segment accessibleRange() {
367376
* @return the value of SSR (sum of squared residuals).
368377
* @throws pulse.problem.schemes.solvers.SolverException
369378
*/
370-
371379
@Override
372380
public double objectiveFunction(GeneralTask task) throws SolverException {
373381
process();
@@ -408,4 +416,4 @@ public boolean equals(Object obj) {
408416
return true;
409417
}
410418

411-
}
419+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.