diff --git a/.classpath b/.classpath index 49faf461..0eb3c4fb 100644 --- a/.classpath +++ b/.classpath @@ -6,7 +6,7 @@ - + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 9f84592c..a474f512 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,6 +1,6 @@ eclipse.preferences.version=1 encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8 -encoding//src/test=ISO-8859-1 -encoding//src/test/resources=ISO-8859-1 -encoding/=ISO-8859-1 -encoding/src=ISO-8859-1 +encoding//src/test=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 +encoding/src=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index ecb498c8..43939db6 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,9 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.compliance=21 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -13,4 +13,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=17 +org.eclipse.jdt.core.compiler.source=21 diff --git a/src/clickDetector/tdPlots/ClickEventSymbolChooser.java b/src/clickDetector/tdPlots/ClickEventSymbolChooser.java index 3da72c23..8d9c5074 100644 --- a/src/clickDetector/tdPlots/ClickEventSymbolChooser.java +++ b/src/clickDetector/tdPlots/ClickEventSymbolChooser.java @@ -1,17 +1,11 @@ package clickDetector.tdPlots; -import java.awt.Color; - import PamView.GeneralProjector; -import PamView.PamColors; import PamView.symbol.StandardSymbolChooser; import PamView.symbol.StandardSymbolManager; import PamView.symbol.StandardSymbolOptions; import PamView.symbol.SymbolData; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import clickDetector.ClickTrainDetection; -import clickDetector.offlineFuncs.OfflineEventDataUnit; public class ClickEventSymbolChooser extends StandardSymbolChooser { diff --git a/src/clickDetector/tdPlots/ClickEventSymbolManager.java b/src/clickDetector/tdPlots/ClickEventSymbolManager.java index 89ce1d02..0c068486 100644 --- a/src/clickDetector/tdPlots/ClickEventSymbolManager.java +++ b/src/clickDetector/tdPlots/ClickEventSymbolManager.java @@ -1,12 +1,6 @@ package clickDetector.tdPlots; -import PamView.GeneralProjector; -import PamView.symbol.StandardSymbolChooser; -import PamView.symbol.StandardSymbolManager; import PamView.symbol.SymbolData; -import PamView.symbol.modifier.SuperDetSymbolModifier; -import PamguardMVC.PamDataBlock; -import PamguardMVC.superdet.SuperDetDataBlock; import PamguardMVC.superdet.swing.SuperDetectionSymbolManager; import clickDetector.offlineFuncs.OfflineEventDataBlock; diff --git a/src/cpod/CPODControl2.java b/src/cpod/CPODControl2.java index cd13fe33..2abe52c1 100644 --- a/src/cpod/CPODControl2.java +++ b/src/cpod/CPODControl2.java @@ -17,7 +17,6 @@ import PamController.SettingsPane; import PamView.PamDetectionOverlayGraphics; import PamView.PamSymbol; import PamView.WrapperControlledGUISwing; -import clickTrainDetector.logging.ClickTrainDetSubLogging; import cpod.dataPlotFX.CPODDPlotProvider; import cpod.dataPlotFX.CPODPlotProviderFX; import cpod.fx.CPODGUIFX; @@ -111,6 +110,8 @@ public class CPODControl2 extends PamControlledUnit implements PamSettings { //must set overlay draw so that hover text can be extracted from general projector and thus plotted on TDGraphFX . This is a HACK and should be sorted. cp1DataBlock.setOverlayDraw(new PamDetectionOverlayGraphics(cp1DataBlock, new PamSymbol())); + + // // add the CP3 data block // cpodProcess.addOutputDataBlock(cp3DataBlock = new CPODClickDataBlock("CP3 Data", // cpodProcess, CPODMap.FILE_CP3)); @@ -125,6 +126,9 @@ public class CPODControl2 extends PamControlledUnit implements PamSettings { clickTrainDataBlock= new CPODClickTrainDataBlock(this, cpodProcess, "CPOD Click Trains", 0); clickTrainDataBlock.SetLogging(clickTrainDetLogging = new CPODClickTrainLogging(this, clickTrainDataBlock)); clickTrainDetLogging.setSubLogging(new CPODSubDetLogging(clickTrainDetLogging, clickTrainDataBlock)); + //create symbols for clicks trains + clickTrainDataBlock.setPamSymbolManager(new CPODTrainSymbolManager(clickTrainDataBlock)); + //makes sure the click trains are loaded int maxndays = 5; //maximum days to load. AbstractScrollManager.getScrollManager().addToSpecialDatablock(clickTrainDataBlock, maxndays*24*60*60*1000L , maxndays*24*60*60*1000L); diff --git a/src/cpod/CPODImporter.java b/src/cpod/CPODImporter.java index 33b39d28..d6520b68 100644 --- a/src/cpod/CPODImporter.java +++ b/src/cpod/CPODImporter.java @@ -537,17 +537,12 @@ public class CPODImporter { int count =0; for (Integer key: cpodClickTrains.keySet()) { - if (count%100 ==0) { + if (count%100 == 0) { this.updateMessage(("Add click train data to datablock: " + count + " of " + cpodClickTrains.keySet().size())); this.updateProgress(count, cpodClickTrains.keySet().size()); - // System.out.println("Add click train data to datablock: " + count + " " + cpodClickTrains.keySet().size()); } - - if (count ==3000) { - //temp - break; - } + clickTrainDataBlock.addPamData(cpodClickTrains.get(key)); count++; diff --git a/src/cpod/CPODSymbolManager.java b/src/cpod/CPODSymbolManager.java index 361f6e33..3939f6a9 100644 --- a/src/cpod/CPODSymbolManager.java +++ b/src/cpod/CPODSymbolManager.java @@ -50,6 +50,9 @@ public class CPODSymbolManager extends StandardSymbolManager { //add the peak frequency modifier that allows clicks to be coloured by peak frequency. psc.addSymbolModifier(new PeakFreqModifier(psc)); + //add the peak frequency modifier that allows clicks to be coloured by peak frequency. + psc.addSymbolModifier(new CPODClickTrainModifier(psc)); + // we can also add some default behaviour here to match the old behaviour // these will get overridden once user options are set, but it's good to give defaults. // SymbolModifier eventMod = psc.hasSymbolModifier(SuperDetSymbolModifier.class); diff --git a/src/cpod/CPODTrainSymbolManager.java b/src/cpod/CPODTrainSymbolManager.java new file mode 100644 index 00000000..6d25bf2e --- /dev/null +++ b/src/cpod/CPODTrainSymbolManager.java @@ -0,0 +1,16 @@ +package cpod; + +import PamView.symbol.SymbolData; +import PamguardMVC.superdet.swing.SuperDetectionSymbolManager; + +public class CPODTrainSymbolManager extends SuperDetectionSymbolManager { + + public CPODTrainSymbolManager(CPODClickTrainDataBlock pamDataBlock) { + super(pamDataBlock, new SymbolData()); + super.setSpecialColourName("Event Colour"); + } + + +} + + diff --git a/src/decimator/layoutFX/DecimatorSettingsPane.java b/src/decimator/layoutFX/DecimatorSettingsPane.java index 2bb15c56..62803e9e 100644 --- a/src/decimator/layoutFX/DecimatorSettingsPane.java +++ b/src/decimator/layoutFX/DecimatorSettingsPane.java @@ -1,11 +1,42 @@ package decimator.layoutFX; +import java.awt.BorderLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; + +import javax.swing.AbstractButton; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; + +import PamController.PamController; import PamController.SettingsPane; +import PamDetection.RawDataUnit; +import PamView.dialog.PamGridBagContraints; +import PamView.dialog.SourcePanel; +import PamView.panel.PamAlignmentPanel; +import PamguardMVC.PamDataBlock; +import dataMap.filemaps.OfflineFileDialogPanel; import decimator.DecimatorControl; import decimator.DecimatorParams; +import decimator.DecimatorParamsDialog.DefaultFilterButton; +import decimator.DecimatorParamsDialog.FilterButton; +import decimator.DecimatorParamsDialog.SPMonitor; +import decimator.DecimatorParamsDialog.SPSelection; import javafx.scene.Node; import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.Pane; import pamViewFX.fxNodes.PamBorderPane; +import pamViewFX.fxNodes.PamButton; +import pamViewFX.fxNodes.PamGridPane; +import pamViewFX.fxNodes.PamVBox; +import pamViewFX.fxNodes.utilityPanes.SourcePaneFX; /** * @@ -17,14 +48,99 @@ public class DecimatorSettingsPane extends SettingsPane { private PamBorderPane mainPane; + private DecimatorControl decimatorControl; + + private SourcePaneFX sourcePanel; + + private Label sourceSampleRate; + + private float inputSampleRate; + + private TextField newSampleRate; + public DecimatorSettingsPane(DecimatorControl aquisitionControl) { super(null); mainPane= new PamBorderPane(); - + this.decimatorControl = aquisitionControl; + mainPane.setCenter(new Label("Hello Decimator Pane")); } + + private Pane createPane() { + + PamVBox mainPanel = new PamVBox(); + + GridBagConstraints constraints = new PamGridBagContraints(); +// insets = new Insets(2,2,2,2); + + sourcePanel = new SourcePaneFX( RawDataUnit.class, true, true); + sourcePanel.addSelectionListener((obsval, oldVal, newVal)->{ + newDataSource(); + }); + +// sourcePanel.addSourcePanelMonitor(new SPMonitor()); + mainPanel.getChildren().add(sourcePanel.getPane()); + + PamGridPane decimatorPanel = new PamGridPane(); + + + Label label = new Label("Decimator settings"); + + int gridx = 0; + int gridy = 0; + decimatorPanel.add(new Label("Source sample rate "), gridx, gridy); + gridx++; + decimatorPanel.add(sourceSampleRate = new Label(" - Hz"), gridx, gridy); + gridx = 0; + gridy ++; + decimatorPanel.add(new JLabel("Output sample rate "), gridx, gridy); + gridx ++; + decimatorPanel.add(newSampleRate = new TextField(), gridx, gridy); + gridx ++; + decimatorPanel.add(new JLabel(" Hz"), gridx, gridy); + gridy ++; + gridx = 0; + gridwidth = 1; + decimatorPanel.add(filterButton = new PamButton("Filter settings"), gridx, gridy); + filterButton.addActionListener(new FilterButton()); + gridx = 1; + gridwidth = 2; + addComponent(decimatorPanel, defaultFilterButton = new PamButton("Default Filter"), gridx, gridy); + defaultFilterButton.addActionListener(new DefaultFilterButton()); + gridx = 0; + gridwidth = 3; + gridy++; + addComponent(decimatorPanel, filterInfo = new JLabel("Filter: "), gridx, gridy); + gridx = 0; + gridwidth = 1; + gridy++; + addComponent(decimatorPanel, new JLabel("Interpolation: ", JLabel.RIGHT), gridx, gridy); + gridx += gridwidth; + gridwidth = 2; + addComponent(decimatorPanel, interpolator = new JComboBox(), gridx, gridy); + interpolator.addItem("None"); + interpolator.addItem("Linear"); + interpolator.addItem("Quadratic"); + + isViewer = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW; + if (isViewer) { + JTabbedPane tabbedPane = new JTabbedPane(); + offlineDAQDialogPanel = new OfflineFileDialogPanel(decimatorControl, this); + tabbedPane.add("Offline Files", offlineDAQDialogPanel.getComponent()); + tabbedPane.add("Runtime Settings", mainPanel); + setDialogComponent(tabbedPane); + } + else { + setDialogComponent(mainPanel); + } + + setHelpPoint("sound_processing.decimatorHelp.docs.decimator_decimator"); + filterButton.setToolTipText("Manual adjustment of filter settings"); + defaultFilterButton.setToolTipText("Set a default filter (6th order Butterworth low pass at Decimator Nyquist frequency)"); + interpolator.setToolTipText("If Decimation / upsampling is not by an integer value, you should use interpolation to improve waveform reconstruction"); + } @Override @@ -55,5 +171,13 @@ public class DecimatorSettingsPane extends SettingsPane { // TODO Auto-generated method stub } + + private void newDataSource() { + PamDataBlock block = sourcePanel.getSource(); + if (block != null) { + sourceSampleRate.setText(String.format("%.1f Hz", + inputSampleRate = block.getSampleRate())); + } + } }