Fix ICI display bug in click detector
This commit is contained in:
Douglas Gillespie 2023-01-19 17:53:59 +00:00
parent a89279ef81
commit 269398890e
7 changed files with 358 additions and 230 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId> <groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId> <artifactId>Pamguard</artifactId>
<version>2.02.07a</version> <version>2.02.07b</version>
<name>Pamguard Java12+</name> <name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description> <description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url> <url>www.pamguard.org</url>

View File

@ -31,12 +31,12 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release. * Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f' * Note: can't go higher than sub-release 'f'
*/ */
static public final String version = "2.02.07a"; static public final String version = "2.02.07b";
/** /**
* Release date * Release date
*/ */
static public final String date = "10 January 2023"; static public final String date = "19 January 2023";
// /** // /**
// * Release type - Beta or Core // * Release type - Beta or Core

View File

@ -1697,14 +1697,13 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
*/ */
public int getColourIndex() { public int getColourIndex() {
/* /*
* This can go wrong when UID > 2^31 since the colour choser takes * This can go wrong when UID > 2^31 since the colour chooser takes
* a mod WRT number of whale colours and it doesn't like negative numbers. * a mod WRT number of whale colours and it doesn't like negative numbers.
* So need to keep the value going in positive. * So need to keep the value going in positive.
*/ */
long uid = getUID(); long uid = getUID();
uid -= uid/2^31; uid &= 0x7FFFFFFF; // avoid anything in top bit of an int32 or higher
return (int) uid; return (int) uid;
// return (int) getUID();
} }
/** /**

File diff suppressed because it is too large Load Diff

View File

@ -1511,7 +1511,7 @@ public class ClickDetection extends PamDataUnit<PamDataUnit, PamDataUnit> implem
* @param iCI the iCI to set * @param iCI the iCI to set
*/ */
public void setICI(double iCI) { public void setICI(double iCI) {
ICI = iCI; this.ICI = iCI;
} }
protected void setChannelGroupDetector(ChannelGroupDetector channelGroupDetector) { protected void setChannelGroupDetector(ChannelGroupDetector channelGroupDetector) {

View File

@ -140,6 +140,7 @@ public class PamScrollSlider extends AbstractPamScrollerAWT {
valueMillis = Math.max(scrollerData.minimumMillis, Math.min(scrollerData.maximumMillis, valueMillis)); valueMillis = Math.max(scrollerData.minimumMillis, Math.min(scrollerData.maximumMillis, valueMillis));
int val = (int) ((valueMillis - scrollerData.minimumMillis) / scrollerData.getStepSizeMillis()); int val = (int) ((valueMillis - scrollerData.minimumMillis) / scrollerData.getStepSizeMillis());
if (val >= slider.getMinimum() && val <= slider.getMaximum()) { if (val >= slider.getMinimum() && val <= slider.getMaximum()) {
// System.out.printf("Set slider val %d in range %d to %d\n", val, slider.getMinimum(), slider.getMaximum());
slider.setValue(val); slider.setValue(val);
} }
} }

View File

@ -699,6 +699,23 @@ public class ViewerScrollerManager extends AbstractScrollManager implements PamS
if (aScroller == pamScroller) { if (aScroller == pamScroller) {
continue; continue;
} }
/*
* Can end up with some horrible feedback here if two
* coupled scrollers bring in rounding errors and start
* to oscillate each other.
*/
long currentVal = aScroller.getValueMillis();
long change = Math.abs(value-currentVal);
long range = aScroller.getMaximumMillis() - aScroller.getMinimumMillis();
if (range == 0) {
aScroller.setValueMillis(aScroller.getMinimumMillis());
continue;
}
double fracChange = (double) change / (double) range;
if (fracChange <= .0001) {
continue;
}
aScroller.setValueMillis(value); aScroller.setValueMillis(value);
} }
} }