This commit is contained in:
Douglas Gillespie 2022-02-08 11:58:25 +00:00
commit 1a59d7c08c
22 changed files with 303 additions and 41 deletions

View File

@ -8,7 +8,6 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PamGuard Working</name>
<name>PamGuard Main</name>
<comment></comment>
<projects>
</projects>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="package shade:shade"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-13/"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-mx6000m&#13;&#10;-Djava.library.path=lib64"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/PamGuard Main}"/>
</launchConfiguration>

View File

@ -0,0 +1,16 @@
To build an executable jar file from the PAMGuard source using Eclipse, you need to use this build configuration
'Build PAMGuard.launch'
You cannot simply export the project as a runnable jar file, or you will not get the required Maven dependencies.
To use this with Eclipse, from your workspace, select File, then import, then in the list of things to be imported select
Run/Debug Launch Configurations, hit Next
Then in the Import Launch Configurations panel, browse to this folder. Select the folder (not a specific file)
then in the left panel, select the folder, then in the right panel the configuration you wish to import
(i.e. Build PAMGuard.launch) and hit Finish
Then go to 'Run Configurations' and find the launch in the 'Maven Builds' section. You'll probably have to change the
Base directory at the top of the panel to select the right project within your workspace.
Once that's done, you can Run the configuration. It will take a while to get all the Maven dependencies and will output
a runnable jar file into the 'targets' folder in your workspace.
The name and version number of the created files are taken from the POM.xml file, so edit that if you want a different name.
For unknown reasons, it makes three files. They are all the same, you can delete the ones starting with 'original-' and
ending with '-shared'

View File

@ -2,9 +2,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>PamguardBeta</artifactId>
<artifactId>Pamguard</artifactId>
<name>Pamguard Java12+</name>
<version>2.02.02</version>
<version>2.02.03a</version>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
<organization>
@ -191,11 +191,6 @@
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<snapshots />
<id>github</id>
<url>https://maven.pkg.github.com/macster110/jpam</url>
</repository>
</repositories>
<reporting>
<plugins>

10
pom.xml
View File

@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>PamguardBeta</artifactId>
<version>2.02.02</version>
<artifactId>Pamguard</artifactId>
<version>2.02.03a</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
@ -318,7 +318,7 @@
<dependency>
<groupId>io.github.macster110</groupId>
<artifactId>jpamutils</artifactId>
<version>0.0.55</version>
<version>0.0.56</version>
</dependency>
<!--jpam project - Deep learning java library
@ -329,7 +329,7 @@
<dependency>
<groupId>io.github.macster110</groupId>
<artifactId>jdl4pam</artifactId>
<version>0.0.92</version>
<version>0.0.93</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
@ -772,7 +772,7 @@
<version>1.0.2</version>
</dependency>
-->
<!-- not in Maven repository -->
<dependency>
<groupId>pamguard.org</groupId>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -558,23 +558,35 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
boolean ans = false;
if (folderInputParameters.mergeFiles == false) return false;
long fileEndTime = 0;
long currFileStart = 0;
long currFileLength = 0;
long currFileEnd = 0;
if (currentFile >= 0) {
try {
WavFileType currentWav = allFiles.get(currentFile);
currFileStart = getFileStartTime(currentWav.getAbsoluteFile());
if (audioStream != null) {
fileSamples = audioStream.getFrameLength();
currFileLength = (long) (fileSamples * 1000 / audioStream.getFormat().getFrameRate());
currFileEnd = currFileStart + currFileLength;
}
}
catch (Exception e) {
}
}
if (currFileEnd == 0) {
// System.out.println("OpenNextfile " + currentFile + " " + allFiles.get(currentFile).getName());
// also check to see if the start time of the next file is the same as the
// end time of the current file.
currFileEnd = PamCalendar.getTimeInMillis();
long lastBit = (long) ((blockSamples * 1000L) / getSampleRate());
currFileEnd += lastBit;
}
if (++currentFile < allFiles.size()) {
if (currentFile >= 0) {
WavFileType currentWav = allFiles.get(currentFile);
fileEndTime = getFileStartTime(currentWav.getAbsoluteFile());
fileEndTime += currentWav.getDurationInSeconds()* 1000.;
}
else {
// System.out.println("OpenNextfile " + currentFile + " " + allFiles.get(currentFile).getName());
// also check to see if the start time of the next file is the same as the
// end time of the current file.
fileEndTime = PamCalendar.getTimeInMillis();
long lastBit = (long) ((blockSamples * 1000L) / getSampleRate());
fileEndTime += lastBit;
}
long newStartTime = getFileStartTime(getCurrentFile());
long diff = newStartTime - fileEndTime;
long diff = newStartTime - currFileEnd;
if (diff > 2000 || diff < -5000 || newStartTime == 0) {
currentFile--;
return false;

View File

@ -109,7 +109,12 @@ public class FilterControl extends PamControlledUnit implements PamSettings {
public void notifyModelChanged(int changeType) {
//System.out.println("FFTControl: notifyModelChanged : " +changeType);
super.notifyModelChanged(changeType);
if (filterGUIFX!=null) filterGUIFX.notifyGUIChange(changeType);
if (changeType == PamController.INITIALIZATION_COMPLETE) {
filterProcess.setupProcess();
}
if (filterGUIFX!=null) {
filterGUIFX.notifyGUIChange(changeType);
}
}
public Serializable getSettingsReference() {

View File

@ -75,8 +75,12 @@ public class FilterProcess extends PamProcess {
if (rawDataBlock == null) {
return;
}
filterControl.filterParams.channelBitmap &= rawDataBlock.getChannelMap();
outputData.setChannelMap(filterControl.filterParams.channelBitmap);
boolean initComplete = PamController.getInstance().isInitializationComplete();
if (initComplete) {
int rawChannels = rawDataBlock.getChannelMap();
filterControl.filterParams.channelBitmap &= rawDataBlock.getChannelMap();
outputData.setChannelMap(filterControl.filterParams.channelBitmap);
}
int maxChan = PamUtils.getHighestChannel(filterControl.filterParams.channelBitmap);
iirfFilters = new Filter[maxChan+1];
FilterMethod filterMethod = FilterMethod.createFilterMethod(getSampleRate(), filterControl.filterParams.filterParams);

View File

@ -31,7 +31,7 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f'
*/
static public final String version = "2.02.03";
static public final String version = "2.02.03a";
/**
* Release date

View File

@ -69,7 +69,7 @@ public class RWStandardClassifier implements RWClassifier {
@Override
public int getSoundClass(RWESound aSound) {
int soundType = 0;
if (!isTonal(aSound)) {
return 0;
}

View File

@ -10,6 +10,11 @@ import loggerForms.dataselect.FormDataSelCreator;
import loggerForms.dataselect.FormDataSelector;
import loggerForms.monitor.FormsDataSelectorCreator;
/**
* User form data selector for use with annotations. Not normal selectors.
* @author dg50
*
*/
public class UserFormDataSelCreator extends AnnotationDataSelCreator {
private FormDataSelCreator formsDataSelectorCreator;

View File

@ -87,6 +87,7 @@ public class GPLProcess extends PamBlockProcess {
addOutputDataBlock(whitenedSpectrogram);
stateDataBlock = new GPLStateDataBlock(this, 0);
stateDataBlock.setBinaryDataSource(new GPLStateDataSource(stateDataBlock));
addOutputDataBlock(stateDataBlock);
gplDetectionBlock = new GPLDetectionBlock(this);
@ -780,12 +781,13 @@ public class GPLProcess extends PamBlockProcess {
// quiet.noise_floor = 1.;
/**
* This is the call to the detector, which is remembering state, will mostly return
* null, but when there has been a detection, will return an object with time and
* frequency information.
*/
}
}
/**
* This is the call to the detector, which is remembering state, will mostly return
* null, but when there has been a detection, will return an object with time and
* frequency information.
*/
public void runDetector(FFTDataUnit fftDataUnit, double[] wData, double base_in, double ceilnoise, double threshfloor) {
// DetectedPeak newPeak = peakDetector.detectPeaks(fftDataUnit, wData, base_in,
// gplParams.noise_ceiling * noise_floor, gplParams.thresh * noise_floor);

View File

@ -0,0 +1,109 @@
package gpl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import binaryFileStorage.BinaryDataSource;
import binaryFileStorage.BinaryHeader;
import binaryFileStorage.BinaryObjectData;
import binaryFileStorage.ModuleFooter;
import binaryFileStorage.ModuleHeader;
public class GPLStateDataSource extends BinaryDataSource {
private GPLStateDataBlock gplStateDataBlock;
private ByteArrayOutputStream bos;
private DataOutputStream dos;
public GPLStateDataSource(GPLStateDataBlock gplStateDataBlock) {
super(gplStateDataBlock);
this.gplStateDataBlock = gplStateDataBlock;
}
@Override
public String getStreamName() {
return "GPL State";
}
@Override
public int getStreamVersion() {
return 0;
}
@Override
public int getModuleVersion() {
return 0;
}
@Override
public byte[] getModuleHeaderData() {
// TODO Auto-generated method stub
return null;
}
@Override
public PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion) {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(binaryObjectData.getData()));
try {
double baseline = dis.readFloat();
double ceilnoise = dis.readFloat();
double threshfloor = dis.readFloat();;
int state = dis.readShort();
GPLStateDataUnit stateData = new GPLStateDataUnit(binaryObjectData.getDataUnitBaseData(), baseline, ceilnoise, threshfloor, state);
return stateData;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh) {
// TODO Auto-generated method stub
return null;
}
@Override
public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh,
ModuleHeader moduleHeader) {
return null;
}
@Override
public BinaryObjectData getPackedData(PamDataUnit pamDataUnit) {
if (bos == null) {
bos = new ByteArrayOutputStream(14);
dos = new DataOutputStream(bos);
}
else {
bos.reset();
}
GPLStateDataUnit stateData = (GPLStateDataUnit) pamDataUnit;
try {
dos.writeFloat((float) stateData.getBaseline());
dos.writeFloat((float) stateData.getCeilnoise());
dos.writeFloat((float) stateData.getThreshfloor());
dos.writeShort((short) stateData.getPeakState());
} catch (IOException e) {
e.printStackTrace();
}
BinaryObjectData bod = new BinaryObjectData(1, bos.toByteArray());
return bod;
}
@Override
public void newFileOpened(File outputFile) {
// TODO Auto-generated method stub
}
}

View File

@ -1,5 +1,6 @@
package gpl;
import PamguardMVC.DataUnitBaseData;
import PamguardMVC.PamDataUnit;
public class GPLStateDataUnit extends PamDataUnit {
@ -30,6 +31,23 @@ public class GPLStateDataUnit extends PamDataUnit {
this.threshfloor = threshfloor;
}
/**
* constructor used reading back from binary files.
* @param baseData
* @param baseline
* @param ceilnoise
* @param threshfloor
* @param peakState
*/
public GPLStateDataUnit(DataUnitBaseData baseData,double baseline,
double ceilnoise, double threshfloor, int peakState) {
super(baseData);
this.baseline = baseline;
this.peakState = peakState;
this.ceilnoise = ceilnoise;
this.threshfloor = threshfloor;
}
/**
* @return the ceilnoise
*/

View File

@ -44,7 +44,7 @@ public class FormPlotOptions implements Serializable, Cloneable, ManagedParamete
*/
public boolean isPlotControl(int controlIndex, int itemIndex) {
checkDimension(controlIndex, itemIndex);
return controlChoices[controlIndex][itemIndex];
return controlChoices[controlIndex][itemIndex] | true;
}
/**

View File

@ -4,6 +4,10 @@ import PamController.PamController;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess;
import PamguardMVC.dataSelector.DataSelector;
import PamguardMVC.dataSelector.DataSelectorCreator;
import loggerForms.dataselect.FormDataSelCreator;
import loggerForms.monitor.FormsDataSelectorCreator;
/**
*
* @author Graham Weatherup
@ -18,6 +22,7 @@ public class FormsDataBlock extends PamDataBlock<FormsDataUnit> {
super(FormsDataUnit.class, dataName, parentProcess, channelMap);
this.formDescription = formDescription;
setNaturalLifetime(600);
setDataSelectCreator(new FormDataSelCreator(this, formDescription));
// setBinaryDataSource(new FormsBinaryIO(formDescription.getFormsControl(), this));
// setNaturalLifetimeMillis(60000);
}
@ -26,6 +31,18 @@ public class FormsDataBlock extends PamDataBlock<FormsDataUnit> {
return formDescription;
}
// @Override
// public DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType) {
// // TODO Auto-generated method stub
// return super.getDataSelector(selectorName, allowScores, selectorType);
// }
//
// @Override
// public DataSelectorCreator getDataSelectCreator() {
//
// dataSelectorCreator = new FormDataSelCreator(this, formDescription);
// }
/**
* Override this for Logger forms so that they always save.
* @param pamDataUnit dataunit to consider

View File

@ -1,5 +1,6 @@
package loggerForms;
import GPS.GpsData;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataUnit;
/**
@ -27,6 +28,8 @@ public class FormsDataUnit extends PamDataUnit {
*/
private Object[] formData;
private FormDescription formDescription;
private GpsData formOriginLatLong;
/**
* Constructor for a form data unit.
@ -72,5 +75,23 @@ public class FormsDataUnit extends PamDataUnit {
this.updateDataUnit(PamCalendar.getTimeInMillis());
}
@Override
public GpsData getOriginLatLong(boolean recalculate) {
/**
* Need to do something a bit different here since Logger form data is generally
* not associated with a hydrophone (though that may change in the future).
* All we really want is the primary origin method, which is either GPS data
* or static data and then get the value. mostly people will want the GPS position
* for the time of the logger data, though really we should make a much better way
* of doing this, including offsets from GPS, options to use the hydrophones if
* we want to as a reference, etc.
*/
if (recalculate || formOriginLatLong == null) {
formOriginLatLong = loggerForm.getOriginLatLong(this);
}
return formOriginLatLong;
}
}

View File

@ -25,6 +25,12 @@ import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.Timer;
import Array.streamerOrigin.GPSOriginMethod;
import Array.streamerOrigin.GPSOriginSystem;
import Array.streamerOrigin.HydrophoneOriginMethod;
import Array.streamerOrigin.HydrophoneOriginMethods;
import Array.streamerOrigin.OriginIterator;
import Array.streamerOrigin.StaticOriginSystem;
import loggerForms.PropertyTypes;
import loggerForms.controlDescriptions.ControlDescription;
import loggerForms.controlDescriptions.ControlTypes;
@ -33,6 +39,7 @@ import loggerForms.controls.CounterControl;
import loggerForms.controls.LoggerControl;
import loggerForms.controls.NMEAControl;
import GPS.GPSDataBlock;
import GPS.GpsData;
import GPS.GpsDataUnit;
import NMEA.NMEADataBlock;
import NMEA.NMEADataUnit;
@ -44,6 +51,7 @@ import PamView.dialog.PamDialog;
import PamView.dialog.PamLabel;
import PamView.panel.PamPanel;
import PamView.panel.VerticalLayout;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamObservable;
import PamguardMVC.PamObserver;
@ -94,6 +102,10 @@ public class LoggerForm{
private boolean hasCounter=false;
private CounterControl counter;
private HydrophoneOriginMethods origins = HydrophoneOriginMethods.getInstance();
/**
* @return the hasCounter
*/
@ -898,6 +910,32 @@ public class LoggerForm{
public JButton getSaveButton() {
return saveButton;
}
public GpsData getOriginLatLong(FormsDataUnit formsDataUnit) {
GpsData gps = getOrigin(GPSOriginSystem.class, formsDataUnit);
if (gps != null) {
return gps;
}
gps = getOrigin(StaticOriginSystem.class, formsDataUnit);
return gps;
}
private GpsData getOrigin(Class originClass, FormsDataUnit formsDataUnit) {
HydrophoneOriginMethod origin = origins.getMethod(GPSOriginMethod.class, null, null);
if (origin == null) {
return null;
}
OriginIterator gpsIter = origin.getGpsDataIterator(PamDataBlock.ITERATOR_END);
GpsData prev = null;
while (gpsIter.hasPrevious()) {
prev = gpsIter.previous();
if (prev.getTimeInMillis() < formsDataUnit.getTimeMilliseconds()) {
break;
}
}
return prev;
}
// /**
// * @return formsDataUnit