Mergg branch 'macster110-main'

This commit is contained in:
Douglas Gillespie 2025-03-18 13:22:40 +00:00
commit 4c67757136
17 changed files with 181 additions and 84 deletions

View File

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

View File

@ -16,7 +16,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>21</javafx.version>
<javafx.version>23</javafx.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- Tethys version control -->

View File

@ -1,7 +1,13 @@
package PamController.command;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.JFrame;
import PamController.PamController;
import PamView.GuiFrameManager;
public class HelpCommand extends ExtCommand {
private CommandManager commandManager;
@ -25,6 +31,22 @@ public class HelpCommand extends ExtCommand {
out += "\n";
}
}
// check the focus
GuiFrameManager gui = PamController.getInstance().getGuiFrameManager();
System.out.println("Check GUI focus " + gui);
if (gui != null) {
JFrame frame = gui.getFrame(0);
Component focussed = frame.getMostRecentFocusOwner();
if (focussed != null) {
System.out.printf("Focussed is %s: %s\n", focussed.toString(), focussed.getName());
}
else {
System.out.println("No focus available: " + focussed);
}
}
commandManager.sendData(this, out);
return getName();
}

View File

@ -1,5 +1,7 @@
package annotation;
import org.w3c.dom.Element;
import PamView.symbol.PamSymbolChooser;
import PamView.symbol.modifier.SymbolModifier;
import PamguardMVC.PamDataBlock;

View File

@ -172,7 +172,7 @@ public class DataMapControl extends PamControlledUnit implements PamSettings {
getDataMapGUI().createDataGraphs();
dataMapPanel.repaintAll();
}
break;
// break;
case PamControllerInterface.OFFLINE_DATA_LOADED:
// System.out.println("DataMap notification " + changeType);
dataMapPanel.repaintAll();

View File

@ -17,6 +17,7 @@ import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.sound.sampled.AudioFormat.Encoding;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
//import org.kc7bfi.jflac.FLACDecoder;
@ -198,12 +199,24 @@ public abstract class OfflineFileServer<TmapPoint extends FileDataMapPoint> impl
mapDialog.setVisible(false);
}
}
//this is how progress should be passed to the GUI?
System.out.println("The offline wav file map has finished loading: ");
PamController.getInstance().notifyTaskProgress(
new FileMapProgress(FileMapProgress.STATUS_DONE, 0, 0, ""));
PamController.getInstance().notifyModelChanged(PamControllerInterface.CHANGED_OFFLINE_DATASTORE);
/**
* 2025/03 - Very strange bug. whenever the Offline Sound data is loaded the
* whole of PAMGuard freezes. There are no thread locks, no infinite loops, no
* recursion etc. the bug is intermittent but removing notifymodelChnaged seems to
* sort it out. Have put the notifyModelChanged with invokeLater as an attempt to
* sort this but not ideal.
*/
SwingUtilities.invokeLater(()->{
PamController.getInstance().notifyTaskProgress(
new FileMapProgress(FileMapProgress.STATUS_DONE, 0, 0, ""));
PamController.getInstance().notifyModelChanged(PamControllerInterface.CHANGED_OFFLINE_DATASTORE);
});
//this is how progress should be passed to the GUI?
System.out.println("The offline wav file map has finished loading 2: ");
}

View File

@ -238,11 +238,15 @@ public class TDControlAWT extends TDControl implements UserDisplayComponent {
public void notifyModelChanged(int changeType) {
// System.out.println("TDControlAWT: Notify model changed: " + changeType );
//need to push onto fx thread.
Platform.runLater(()->{
if (tdMainDisplay!=null){
tdMainDisplay.notifyModelChanged(changeType);
}
});
if (!Platform.isFxApplicationThread()) {
Platform.runLater(()->{
if (tdMainDisplay!=null) tdMainDisplay.notifyModelChanged(changeType);
});
}
else {
if (tdMainDisplay!=null) tdMainDisplay.notifyModelChanged(changeType);
}
}
/**

View File

@ -177,7 +177,12 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
*/
private PamBorderPane extraSymbolPane;
private ToggleSwitch freqSwitch;
private ToggleSwitch freqSwitch;
/**
* Indicates whether min or max pane is changing to stop overlfow
*/
private volatile boolean minMxPaneChange = false;
public ClickControlPane2(ClickPlotInfoFX clickPlotInfo) {
@ -210,7 +215,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
scrollPane2.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane2.getStyleClass().clear();
symbolTab.setContent(scrollPane2);
Tab dataView=new Tab("Data");
dataView.setContent(dataSelectHolder);
dataView.getStyleClass().add("tab-square");
@ -226,11 +231,11 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
enablePane();
setFreqType();
setParams();
dataSelectPane.addSettingsListener(()->{
//dynamic settings pane so have to repaint whenever a control is selected.
getParams();
/**
* If there are raw amplitude or frequency panes that have a buffer of painted units then
* these have to be cleared for the data selector
@ -238,7 +243,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickRawPlotManager().clear();
clickPlotInfo.getClickFFTPlotManager().clear();
clickPlotInfo.getTDGraph().repaint(50);
});
@ -253,7 +258,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
* @return the data select pane.
*/
private DynamicSettingsPane<Boolean> createDataSelectPane(){
// System.out.println("DATA SELECTOR: " + clickPlotInfo.getClickDataSelector());
// System.out.println("DATA SELECTOR: " + clickPlotInfo.getClickDataSelector());
return clickPlotInfo.getClickDataSelector().getDialogPaneFX();
}
@ -294,7 +299,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickSizePane = this.createClickSizePane(); //pane for selecting the size of clicks.
//
/**Frequency Pane**/
freqThresholdPane = createFreqThresholdPane(); //pane for spectrogram showing clicks
freqColourPane = createFreqColorPane(); //pane for setting colour limits if clicks shown as spectrogram
@ -315,12 +320,12 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
Label freqTitle = new Label("Freq. Colour");
PamGuiManagerFX.titleFont2style(freqTitle);
PamVBox vBox = new PamVBox();
vBox.setSpacing(5);
vBox.getChildren().addAll(freqTitle, hBox );
freqPane.setTop(vBox);
symbolOptionsPane.getMainPane().setCenter(extraSymbolPane = new PamBorderPane());
symbolOptionsPane.getMainPane().setMaxWidth(PREF_WIDTH);
@ -361,14 +366,14 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
setFreqPaneType(FREQ_PANE_THRESHOLD);
extraSymbolPane.setCenter(freqPane);
setFreqPaneType(freqSwitch.isSelected() ? FREQ_PANE_COLOUR : FREQ_PANE_THRESHOLD);
symbolOptionsPane.getVBoxHolder().setDisable(freqSwitch.isSelected());
}
else {
extraSymbolPane.setCenter(clickSizePane);
}
// //the colour choice
// int colourChoice = ((ClickSymbolOptions) clickPlotInfo.getClickSymbolChooser().getSymbolChooser().getSymbolOptions()).colourChoice;
//
@ -473,32 +478,39 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
});
minMaxWidthPane.setPrefSpinnerWidth(80);
Label newLabelWidth = new Label();
// newLabelWidth.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_H,
// PamGuiManagerFX.iconSize));
// newLabelWidth.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_H,
// PamGuiManagerFX.iconSize));
newLabelWidth.setGraphic(PamGlyphDude.createPamIcon("mdi2a-arrow-left-right-bold", PamGuiManagerFX.iconSize));
newLabelWidth.setPrefWidth(20);
minMaxWidthPane.getChildren().add(0, newLabelWidth);
//height pane
minMaxHeightPane = new DualControlField<Double>("", "" , "", 2, 100, 1);
minMxPaneChange = false;
minMaxHeightPane.addChangeListener((obsval, oldval, newval)->{
newSettings();
//do not allow the min ti be larger than the max.
if (minMaxHeightPane.getSpinner().getValue()>=minMaxHeightPane.getSpinner2().getValue()) {
minMaxHeightPane.getSpinner().getValueFactory().setValue(minMaxHeightPane.getSpinner2().getValue()-1.0);
return;
}
if (!minMxPaneChange == false) {
minMxPaneChange = true;
//do not allow the min ti be larger than the max.
if (minMaxHeightPane.getSpinner().getValue()>=minMaxHeightPane.getSpinner2().getValue()) {
if (minMaxHeightPane.getSpinner2().getValue()<=minMaxHeightPane.getSpinner().getValue()) {
minMaxHeightPane.getSpinner2().getValueFactory().setValue(minMaxHeightPane.getSpinner().getValue()+1.0);
minMaxHeightPane.getSpinner().getValueFactory().setValue(minMaxHeightPane.getSpinner2().getValue()-1.0);
return;
}
if (minMaxHeightPane.getSpinner2().getValue()<=minMaxHeightPane.getSpinner().getValue()) {
minMaxHeightPane.getSpinner2().getValueFactory().setValue(minMaxHeightPane.getSpinner().getValue()+1.0);
}
minMxPaneChange=false;
}
});
minMaxHeightPane.setPrefSpinnerWidth(80);
Label newLabelHeight = new Label();
// newLabelHeight.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_V,
// PamGuiManagerFX.iconSize));
// newLabelHeight.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_V,
// PamGuiManagerFX.iconSize));
newLabelHeight.setGraphic(PamGlyphDude.createPamIcon("mdi2a-arrow-up-down-bold", PamGuiManagerFX.iconSize));
newLabelHeight.setPrefWidth(20);
minMaxHeightPane.getChildren().add(0, newLabelHeight);
@ -596,7 +608,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
spectroControlPane.getColorBox().valueProperty().addListener((obsval, oldval, newval)->{
newSettings();
});
//need to do this so that text of colourbar is not squished when in a scrollpane
spectroControlPane.setMinHeight(85);
@ -623,7 +635,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
fftSpinnerHop.setEditable(true);
fftSpinnerHop.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
fftSpinnerHop.getValueFactory().valueProperty().addListener((obs, before, after)->{
if (after==0) fftSpinnerHop.getValueFactory().setValue(before==0 ? 32 : before);
newSettings(100);
});
@ -715,10 +727,10 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickDisplayParams().freqAmplitudeRange = clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpRange();
};
// if (clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits==null) {
// //can happen with old .psfx save files.
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits =clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpLimits();
// }
// if (clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits==null) {
// //can happen with old .psfx save files.
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits =clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpLimits();
// }
this.spectroControlPane.setAmplitudeRange(clickPlotInfo.getClickDisplayParams().freqAmplitudeRange,
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits);
@ -776,9 +788,9 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits[0] = spectroControlPane.getColourSlider().getMin();
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits[1] = spectroControlPane.getColourSlider().getMax();
clickPlotInfo.getClickDisplayParams().thresholdFFT = !freqSwitch.isSelected();
clickPlotInfo.getClickDisplayParams().fftHop = this.fftSpinnerHop.getValue().intValue();
clickPlotInfo.getClickDisplayParams().fftLength = this.fftSpinnerLength.getValue().intValue();
clickPlotInfo.getClickDisplayParams().colourMap = this.spectroControlPane.getColourArrayType();
@ -839,14 +851,14 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
* Notify the click pane of an update that may change controls
*/
public void notifyUpdate() {
//called whenever the y axis data type changes.
//17/09/2021- this was causing the spectrogram to reset back to normal lines every time
//a module dialog was closed.
//setFreqType();
this.enablePane();
//in case there has been a global medium update.
}

View File

@ -31,6 +31,7 @@ import dataPlotsFX.overlaymark.TDOverlayAdapter;
import dataPlotsFX.scroller.TDAcousticScroller;
import dataPlotsFX.sound.SoundOutputManager;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@ -190,6 +191,9 @@ public class TDDisplayFX extends PamBorderPane {
*/
private PamSplitPane splitPaneHolder;
private SimpleStringProperty mousePosStringProperty = new SimpleStringProperty();
/**
* Constructor for the main JavaFX display.
* @param tdControl - the TDControlFX.
@ -271,6 +275,7 @@ public class TDDisplayFX extends PamBorderPane {
timeStamp=new Label();
mousePositionData = new Label();
mousePositionData.textProperty().bind(this.mousePosStringProperty);
//layout the main pane
layoutTDMainPane(tdParametersFX.orientation);
@ -287,8 +292,8 @@ public class TDDisplayFX extends PamBorderPane {
//layout the graphs within the main panel
layoutTDGraphs(tdParametersFX.orientation);
//need to set the divder positon after the graphs as this doesn;t work if set before.
splitPaneHolder.setDividerPosition(0, 0.95);
//need to set the divider position after the graphs as this doesn't work if set before.
splitPaneHolder.setDividerPosition(0, 0.85);
intilized=true;
}
@ -427,7 +432,7 @@ public class TDDisplayFX extends PamBorderPane {
}
//Set background so that same as the axis colour-fills in box on corner between x and y axis.
timeAxisHolder.getStyleClass().add("pane");
//timeAxisHolder.getStyleClass().add("pane");
//layout the graphs within the main panel
layoutTDGraphs(tdParametersFX.orientation);
@ -1334,7 +1339,7 @@ public class TDDisplayFX extends PamBorderPane {
/**
* @return the mousePositionData
*/
public Label getMousePositionData() {
private Label getMousePositionLabel() {
return mousePositionData;
}
@ -1351,4 +1356,13 @@ public class TDDisplayFX extends PamBorderPane {
});
}
/**
* Simple string property for mouse position in time axis.
* @return the position text property.
*/
public SimpleStringProperty mousePosTextProperty() {
return this.mousePosStringProperty;
}
}

View File

@ -23,6 +23,7 @@ import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamButton;
import pamViewFX.fxNodes.PamGridPane;
import pamViewFX.fxNodes.PamScrollPane;
import pamViewFX.fxNodes.PamVBox;
import pamViewFX.fxNodes.hidingPane.HidingPane;
import pamViewFX.fxNodes.pamAxis.PamAxisFX;
import pamViewFX.fxNodes.pamAxis.PamAxisPane2;
@ -69,6 +70,8 @@ import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
@ -124,7 +127,7 @@ public class TDGraphFX extends PamBorderPane {
* The layered pane contains all the plot panels but also any overlayed nodes,
* e.g buttons to open hiding dialogs.
*/
private PamHiddenSidePane stackPane;
private PamHiddenSidePane mainStackPane;
/**
* List of unique available units for plotting. We may have multiple types of
@ -318,10 +321,10 @@ public class TDGraphFX extends PamBorderPane {
* Create a stack pane to hold everything- means we can add overlay controls and
* buttons Note: icons are set later in setOverlayColour(LIGHT_TD_DISPLAY);
*/
stackPane = new PamHiddenSidePane(null, null, scrollPane, dataSettingsScrollPane);
mainStackPane = new PamHiddenSidePane(null, null, scrollPane, dataSettingsScrollPane);
// stackPane.setMinHidePaneHeight(300);
stackPane.getChildren().add(plotPanels);
mainStackPane.getChildren().add(plotPanels);
plotPanels.toBack(); // need to send to back so hiding panes are not behind in the stack....
// //test
@ -352,7 +355,7 @@ public class TDGraphFX extends PamBorderPane {
// add plots to center of main pane
this.setCenter(stackPane);
this.setCenter(mainStackPane);
// layout axis.
layoutTDGraph(tdDisplay.getTDParams().orientation);
@ -452,8 +455,8 @@ public class TDGraphFX extends PamBorderPane {
setOverlayColour(LIGHT_TD_DISPLAY);
break;
}
stackPane.getLeftHidingPane().getShowButton().setGraphic(chevronRight);
stackPane.getRightHidingPane().getShowButton().setGraphic(settingsRight);
mainStackPane.getLeftHidingPane().getShowButton().setGraphic(chevronRight);
mainStackPane.getRightHidingPane().getShowButton().setGraphic(settingsRight);
}
// /**
@ -610,16 +613,22 @@ public class TDGraphFX extends PamBorderPane {
dataSettingsScrollPane.setContent(dataSettingsTabs);
}
else {
PamBorderPane settingsHolder = new PamBorderPane();
PamVBox settingsHolder = new PamVBox();
Label label = new Label(settingsPane.getShowingName());
label.setTextAlignment(TextAlignment.CENTER);
PamBorderPane.setAlignment(label, Pos.CENTER);
settingsHolder.setTop(label);
settingsHolder.setCenter(settingsPane.getPane());
settingsHolder.setPadding(new Insets(0,0,0,30));
settingsHolder.setAlignment(Pos.TOP_CENTER);
settingsHolder.getChildren().add(label);
settingsHolder.getChildren().add(settingsPane.getPane());
settingsHolder.setMinWidth(settingsPane.getPane().getPrefWidth());
PamVBox.setVgrow(settingsPane.getPane(), Priority.ALWAYS);
settingsHolder.setPadding(new Insets(0,0,0,35));
dataSettingsScrollPane.setContent(settingsHolder);
mainStackPane.getRightHidingPane().setPrefSize(settingsPane.getPane().getPrefWidth()+35,Region.USE_PREF_SIZE);
}
}
@ -1457,7 +1466,7 @@ public class TDGraphFX extends PamBorderPane {
}
public boolean mouseExited(MouseEvent event) {
tdDisplay.getMousePositionData().setText(null);
tdDisplay.mousePosTextProperty().set(null);
return false;
}
@ -1511,18 +1520,29 @@ public class TDGraphFX extends PamBorderPane {
// }
private void sayMousePosition(MouseEvent event) {
//System.out.println("Say mouse text: ");
PamCoordinate screenPos = new Coordinate3d(event.getX(), event.getY());
PamCoordinate dataPos = graphProjector.getDataPosition(screenPos);
if (dataPos==null) return;
String str = String.format("Mouse %s %s ", PamCalendar.formatDate((long) dataPos.getCoordinate(0)),
PamCalendar.formatTime((long) dataPos.getCoordinate(0), true));
// if (currentScaleInfo != null) {
// str += String.format(", %s %3.1f %s ", currentScaleInfo.getDataType(),
// dataPos.getCoordinate(1), currentScaleInfo.unit);
// }
// String fmt = String.format(", %s %%s", graphAxis.)
str += String.format(", %3.2f %s ", graphAxis.getDataValue(event.getY()), graphAxis.getLabel());
tdDisplay.getMousePositionData().setText(str);
System.out.println("Say mouse text: go 2! " + str);
tdDisplay.mousePosTextProperty().set(str);
System.out.println("Say mouse text: go 3 ! " + str);
}
}
@ -1710,7 +1730,7 @@ public class TDGraphFX extends PamBorderPane {
* @return hiding pane which contains nodes for changing settings
*/
public HidingPane getAxisPane() {
return stackPane.getLeftHidingPane();
return mainStackPane.getLeftHidingPane();
}
/**
@ -1720,7 +1740,7 @@ public class TDGraphFX extends PamBorderPane {
* @return hiding pane which contains nodes for changing settings
*/
public HidingPane getSettingsPane() {
return stackPane.getRightHidingPane();
return mainStackPane.getRightHidingPane();
}
/*********** Viewer Mode Functions **************/
@ -1786,8 +1806,8 @@ public class TDGraphFX extends PamBorderPane {
}
//Finally save whether the hiding panels are open or not.
graphParameters.showHidePaneLeft = stackPane.getLeftHidingPane().isShowing();
graphParameters.showHidePaneRight = stackPane.getRightHidingPane().isShowing();
graphParameters.showHidePaneLeft = mainStackPane.getLeftHidingPane().isShowing();
graphParameters.showHidePaneRight = mainStackPane.getRightHidingPane().isShowing();
}
@ -1875,8 +1895,8 @@ public class TDGraphFX extends PamBorderPane {
//Open hide panes if needed.
//Finally save whether the hiding panels are open or not.
stackPane.getLeftHidingPane().showHidePane(graphParameters.showHidePaneLeft);
stackPane.getRightHidingPane().showHidePane(graphParameters.showHidePaneRight);
mainStackPane.getLeftHidingPane().showHidePane(graphParameters.showHidePaneLeft);
mainStackPane.getRightHidingPane().showHidePane(graphParameters.showHidePaneRight);
}
@ -2081,7 +2101,7 @@ public class TDGraphFX extends PamBorderPane {
// " "+ PamCalendar.formatDateTime((long) resultBack.getCoordinate(0)));
});
stackPane.getChildren().add(buttonTest);
mainStackPane.getChildren().add(buttonTest);
// Test
}

View File

@ -71,6 +71,8 @@ public class OverlayGroupDisplay extends PamBorderPane {
* Constructor for the group detection display.
*/
public OverlayGroupDisplay() {
this.setStyle("-fx-background-color: -fx-background;");
//create two displays, one for super detections and the other for the
//sub detections.
detectionsPane= new DetectionGroupDisplay();

View File

@ -71,7 +71,8 @@ public class MultiSpeciesGoogle implements DLModel {
//create the transforms.
ArrayList<DLTransfromParams> dlTransformParamsArr = new ArrayList<DLTransfromParams>();
dlTransformParamsArr.add(new SimpleTransformParams(DLTransformType.DECIMATE_SCIPY, sr));
//Performed long series of test son which decimator is best for upsampling and it is, by far, the DECIMATE transform.
dlTransformParamsArr.add(new SimpleTransformParams(DLTransformType.DECIMATE, sr));
genericModelParams.dlTransfromParams = dlTransformParamsArr;

View File

@ -3,6 +3,7 @@ package test.export;
import test.helper.PamControllerTestHelper;
import clickDetector.ClickControl;
import clickDetector.ClickDetector;
import org.junit.jupiter.api.Test;
import clickDetector.ClickDetection;
@ -21,7 +22,7 @@ public class ExportTest {
public void matFileTest() throws Exception {
PamControllerTestHelper.InitializePamControllerForTesting();
System.out.println("Matched template classifier test: match corr");
System.out.println("Export MATLAB TEST");
//create a list of click detections.
ClickControl control = new ClickControl("name");

View File

@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class OneBandControlTest {
@BeforeAll
public static void setUpBeforeClass() throws Exception {
PamControllerTestHelper.InitializePamControllerForTesting();

View File

@ -92,7 +92,7 @@ public class KooguDLClassifierTest {
GroupedRawData groupedRawData = new GroupedRawData(0, 1, 0, duration, (int) duration);
//koogu predictions are in sam,ples
//koogu predictions are in samples
int startChunk =(int) (kooguPredicitions[i][0]*soundData.sampleRate/250); ///the start chunk is in decimated samples - uuurgh
@ -101,7 +101,6 @@ public class KooguDLClassifierTest {
ArrayList<GroupedRawData> groupedData = new ArrayList<GroupedRawData>();
groupedData.add(groupedRawData);
ArrayList<StandardPrediction> genericPrediciton = kooguWorker.runModel(groupedData, soundData.sampleRate, 0);
float[] output = genericPrediciton.get(0).getPrediction();
@ -113,12 +112,14 @@ public class KooguDLClassifierTest {
if (testPassed) {
truecount++;
}
}
//there are occasionaly slight differences between PMAGuard and Python so just make sure most data points are the same.
double percTrue = 100*((double) truecount)/kooguPredicitions.length;
System.out.println(String.format("Perecentage results true: %.2f count %d", percTrue, truecount));
System.out.println(String.format("Percentage results true: %.2f count %d", percTrue, truecount));
//at least 90% of results must match for the dataset
assertTrue(percTrue>0.9);

View File

@ -8,8 +8,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import org.jamdev.jdl4pam.transforms.DLTransform.DLTransformType;
import org.jamdev.jdl4pam.transforms.SimpleTransformParams;
import org.jamdev.jdl4pam.utils.DLMatFile;
import org.jamdev.jdl4pam.utils.DLUtils;
import org.jamdev.jpamutils.wavFiles.AudioData;
@ -182,7 +180,11 @@ public class PamZipDLClassifierTest {
//path to the same file at different sample rates
String relWavPath = "./src/test/resources/rawDeepLearningClassifier/Generic/multi-species-Google/NOPP6_EST_20090329_121500.wav";
String relWavPath2 = "./src/test/resources/rawDeepLearningClassifier/Generic/multi-species-Google/NOPP6_EST_20090329_121500_upsample.wav";
String relWavPath2 = "./src/test/resources/rawDeepLearningClassifier/Generic/multi-species-Google/NOPP6_EST_20090329_121500_upsample_pg.wav";
/**
* Test up-sampling using audio then downsampling agian
*/
// String relWavPath2 = "./src/test/resources/rawDeepLearningClassifier/Generic/multi-species-Google/NOPP6_EST_20090329_121500.wav";
String matFileOut = "/Users/jdjm/MATLAB-Drive/MATLAB/PAMGUARD/deep_learning/google_multi_species/google_multi_species.mat";
@ -202,13 +204,13 @@ public class PamZipDLClassifierTest {
MultiSpeciesGoogle multiSpeciesGoogle = new MultiSpeciesGoogle();
multiSpeciesGoogle.setParams(genericModelParams);
genericModelParams.dlTransfromParams.set(0, new SimpleTransformParams(DLTransformType.DECIMATE, 24000.));
//genericModelParams.dlTransfromParams.set(0, new SimpleTransformParams(DLTransformType.DECIMATE, 24000.));
System.out.println(genericModelParams);
double segSize = 5.; //one second hop size.
double segHop = 5.; //one second hop size.
int classIndex = 5; //Right whale atlantic - jus for output
int classIndex = 5; //Right whale atlantic - just for output
//create MatFile for saving the image data to.
MatFile matFile = Mat5.newMatFile();
@ -227,9 +229,12 @@ public class PamZipDLClassifierTest {
//load audio
AudioData soundData = DLUtils.loadWavFile(wavFilePath);
//TEMP
// if (i==1) {
// soundData=soundData.interpolate(24000);
// }
//////
int nseg = (int) (soundData.samples.length/(segHop*soundData.sampleRate));
float[][] outputs = new float[nseg][];