diff --git a/.externalToolBuilders/net.sourceforge.metrics.builder.launch b/.externalToolBuilders/net.sourceforge.metrics.builder.launch new file mode 100644 index 00000000..8e11c919 --- /dev/null +++ b/.externalToolBuilders/net.sourceforge.metrics.builder.launch @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.project b/.project index c8e79578..bbeba9cb 100644 --- a/.project +++ b/.project @@ -11,8 +11,13 @@ - net.sourceforge.metrics.builder + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + LaunchConfigHandle + <project>/.externalToolBuilders/net.sourceforge.metrics.builder.launch + diff --git a/README.html b/README.html index e804f29e..45fa3423 100644 --- a/README.html +++ b/README.html @@ -388,7 +388,7 @@ PamguardBeta_ViewerMode.exe):

Latest -Version 2.03.00 June 2024

+Version 2.02.11 May 2024

Version 2.02.10 January 2024

@@ -465,7 +465,7 @@ Version 2.00.10 June 2017 name="_Latest_Version_2.02.06">Version -2.03.00 June 2024 +2.02.11 May 2024

 

@@ -474,11 +474,22 @@ name="_Version_2.02.10_January">Version

Deep Learning Classifier. Major upgrade to support for Deep Learning models in PAMGuard. See online help for details.

-

Click detector: Remembers locations of displays and doesn’t +

Click detector: Remembers locations of displays and doesnÂ’t continually reset them.

Help for Matched Click Classifier.

+

Project information dialog. This allows capture of essential +project information to store with your data. See menu item Settings/Project +information.

+ +

Tethys Database

+ +

Many users will be aware that weÂ’re integrating an interface +to the Tethys Database into PAMGuard. +Some basic features are available for testing. If interested, please contact +the PAMGuard support team.

+

Bug Fixes

Linking clicks to offline clicks table. We had a database @@ -500,14 +511,20 @@ as PAMGuard stops / restarts.

function fixed and now inserts correct times of start and ends of events into database.

-

Acquisition “Skip initial seconds” feature, designed to +

Clip generator. Changes to ensure PAMGuard keeps audio data +long enough to make clips. In some circumstances data were being discarded too +early so clips could not be created.

+ +

Acquisition “Skip initial seconds” feature, designed to remove high sample levels e.g. from calibration tones at start of a soundtrap recording was not working with the click detector. This is fixed but replacing -all data with 0’s and still sending data. Note that this may lead to +all data with 0Â’s and still sending data. Note that this may lead to artificially low noise measures at the start of a file.

Data reprocessing options. Updated to ensure that the option "Start normally. Note risk of overwriting!" is always available. Also +improved code naming binary files to attempt to push them to exact times, +rather than a couple of seconds after the hour.

improved code naming binary files to attempt to push them to exact times, rather than a couple of seconds after the hour.

@@ -531,8 +548,8 @@ files) file performance when scrolling through audio data in Viewer mode.

Viewer Launch by right clicking on sqlite database and selecting “open with / -Pamguard ViewerMode” launcher menu option.

+lang=EN-US> by right clicking on sqlite database and selecting “open with / +Pamguard ViewerMode” launcher menu option.

Bug Fixes

@@ -580,7 +597,7 @@ clicks not being correctly reassigned to different events.

Screen Position: When using multiple monitors, if you move a configuration to a -computer with a different monitor layout, the GUI should work out if it’s +computer with a different monitor layout, the GUI should work out if itÂ’s opening on a screen area which no longer exists and move itself onto the primary monitor.

@@ -588,7 +605,7 @@ primary monitor.

lang=EN-US>: Previous version had a bug which caused files to not always be sorted into the correct order for processing. This caused some instability in some detectors, causing memory leaks when new data arrived with time stamps -earlier than already processed data in memory. This is now fixed – files are ow +earlier than already processed data in memory. This is now fixed – files are ow correctly sorted alphabetically by file name, i.e. not including the name of the folder containing the files.

@@ -610,8 +627,8 @@ were reading local time, even when set to use UTC.

which mostly occurred when processing large datasets of many offline files, has been fixed.

-

Data Map: “Scroll To Data” pop-up menu, which -didn’t always scroll to the correct place, is now fixed.

+

Data Map: “Scroll To Data” pop-up menu, which +didn’t always scroll to the correct place, is now fixed.

Bearing Localiser offline: If reprocessing bearings, the localizer was not correctly loading required raw or FFT data to @@ -634,7 +651,7 @@ files and stores them within the PAMGuard configuration. This does not affect processing, but is important for record keeping.

GPS options to use any valid RMC or GGA -string. Not all GPS receivers output their RMC data as GPRMC – e.g. some may +string. Not all GPS receivers output their RMC data as GPRMC – e.g. some may output as GNRMC. A new option allows the GPS module to use any string, whatever the first two characters of the string name may be.

@@ -643,14 +660,14 @@ the first two characters of the string name may be.

Bug Fixes

Use of localization sensor and orientation -data for static hydrophones had a bug whereby it would continually ‘forget’ +data for static hydrophones had a bug whereby it would continually ‘forgetÂ’ angle offsets applied to static hydrophones in viewer mode. This is now fixed.

Click tool bar: Correctly shows event selection options even if no species classification options are in place.

Fixed Landmarks: Earlier versions were -‘losing’ these every time PAMGuard started or new data were loaded in viewer +‘losingÂ’ these every time PAMGuard started or new data were loaded in viewer mode. Now fixed.

ROCCA: Fixed (another) memory leak which @@ -669,11 +686,11 @@ processing.

New sound type for simulated sounds which generates random chirps between around 200 and 800Hz, roughly the frequency -you’d expect sound from higher frequency baleen whales, such as humpbacks, to +youÂ’d expect sound from higher frequency baleen whales, such as humpbacks, to vocalise at.   

Hiding tool tips. A menu item to -permanently turn off all tool tips, or tap the ‘Esc’ key to turn them off for 6 +permanently turn off all tool tips, or tap the ‘EscÂ’ key to turn them off for 6 seconds if they are getting in the way, particularly when trying to interact with displays using the mouse.

@@ -694,7 +711,7 @@ whistle classification module.

New Features

-

SoundTrap SUD file reading. If you’re using +

SoundTrap SUD file reading. If youÂ’re using SoundTrap autonomous recorders from Ocean Instruments, you no longer need to decompress the SoundTrap files prior to processing. This will save time and a lot of disk space. Extraction of clicks from the inbuilt SoundTrap Click @@ -711,8 +728,8 @@ details.   

Changes to GUI to make dialog shorter for low DPI screens.

-

Complete rewrite of the classification -system to have nested classifiers which can be enabled or disabled.

+

Complete rewrite of the classification system +to have nested classifiers which can be enabled or disabled.

Changes to classification GUI to accommodate the new classification system.

@@ -758,7 +775,7 @@ audio files.

Bug Fixes

Soundtrap DWV import. Will now generate -binary files even if DWV file doesn‚’t exist (which is correct behavior in +binary files even if DWV file doesn‚’t exist (which is correct behavior in quiet conditions when no clicks were detected).

Spectrogram. Changes to stop occasional @@ -793,7 +810,7 @@ running in real time. Added template names based on file names.

#13 Merging files when offline processing file folders: Had an error introduced in last release which caused it to fail to recognise gaps between files, meaning that some output data (i.e. after a gap) would have an -incorrect time stamp. This did not affect data if the ‘merge contiguous files’ +incorrect time stamp. This did not affect data if the ‘merge contiguous filesÂ’ option was not selected.

#14 Logger forms data were not plotting correctly. This was @@ -803,9 +820,9 @@ selections from drop down lists within any form.

 

-

Note that updates have also been made to the Matlab -interface to PAMGuard binary files, which has now also been migrated to GitHub -at https://github.com/PAMGuard/PAMGuardMatlab. +

Note that updates have also been made to the Matlab interface +to PAMGuard binary files, which has now also been migrated to GitHub at https://github.com/PAMGuard/PAMGuardMatlab.

 

@@ -866,7 +883,7 @@ href="http://www.pamguard.org/downloads.php?cat_id=3">here.

Detection Group Localiser

-

This module has been renamed “Detection Grouper”, so as to +

This module has been renamed “Detection Grouper”, so as to avoid confusion with the Group 3D localizer. This is because the Detection Grouper is more for organizing data into groups to be localized than it is for doing localization.

@@ -989,9 +1006,9 @@ included in a future release.

17.        An implementation of the Generalized Power Law Detector, -developed by Tyler Helble ([Helble et al., ‘A generalized power-law detection -algorithm for humpback whale vocalizations’, The Journal of the Acoustical -Society of America, vol. 131, no. 4, pp. 2682–2699, 2012) is now available. For +developed by Tyler Helble ([Helble et al., ‘A generalized power-law detection +algorithm for humpback whale vocalizationsÂ’, The Journal of the Acoustical +Society of America, vol. 131, no. 4, pp. 2682–2699, 2012) is now available. For details, see the online help

18.

+UIDÂ’s are also added to PAMGuard database tables.

Converting Old Data

@@ -2272,13 +2289,13 @@ UID viewer they will automatically be converted. For safety, the original binary files will not be overwritten and the new data will be placed in a new folder on your computer with the same path as the old data, but suffixed with -‘_WithUID’, e.g. if your binary data were previously stored in the folder +‘_WithUIDÂ’, e.g. if your binary data were previously stored in the folder C:\MySurvey\binarydata the new data will be written to C:\MySurvey\binarydata_WithUID.

The additional UID column will be added to all database tables and populated with unique values. For data which are stored -in both the binary files and in database tables, the same UID’s will be used in +in both the binary files and in database tables, the same UIDÂ’s will be used in both data stores.

New Displays

@@ -2342,10 +2359,10 @@ lang=EN-US> 

1.       -Bug 317. Rocca Module Data Purging. The ROCCA -module was not performing data purging when using classifiers developed for Hawaii/Temperate -Pacific/North Atlantic datasets. This has been corrected.

- +Bug 317. Rocca Module Data Purging. The ROCCA module +was not performing data purging when using classifiers developed for +Hawaii/Temperate Pacific/North Atlantic datasets. This has been corrected.

+

2.       Bug 320. Pamguard stopped reading Click Detector Event data from database @@ -2483,9 +2500,9 @@ dependencies)

Other Changes

-

The installer has been updated to handle -both 64 bit and 32 bit installations. PAMGuard psf files are now registered in -the Windows Registry, so double-clicking on a psf file should run PAMGuard in +

The installer has been updated to handle both +64 bit and 32 bit installations. PAMGuard psf files are now registered in the +Windows Registry, so double-clicking on a psf file should run PAMGuard in normal mode (as opposed to Viewer or Mixed modes). Note that the Windows Registry can only hold a single executable reference for psf files; therefore, for users with multiple installations of PAMGuard, double-clicking on a psf @@ -2513,7 +2530,7 @@ November 2016

1.       Bug 303. Some ASIO sound cards not working with either ASIO system in PAMGuard. For the PAMGuard ASIO system, this was due to a data format used by some sound -cards never being properly implemented. For the “New ASIO system” which is +cards never being properly implemented. For the “New ASIO system” which is based on jAsioHost, the unpacking of that format contained a bug which returned incorrect numbers, so data were swamped with noise. Both systems are now fixed. By preference, users should use the PAMGuard ASIO system since the JAsioHost @@ -2624,8 +2641,8 @@ lang=EN-US>3.4.        -Bug 290. Click bearings on spectrogram display plug in -were reversed if the first hydrophone was behind the second hydrophone in the +Bug 290. Click bearings on spectrogram display plug in were +reversed if the first hydrophone was behind the second hydrophone in the configuration. This is now fixed so that it displays the same bearings as the main click detector display.

@@ -2716,10 +2733,10 @@ since V 1.15.03:

1.        -Bug 272. File types: Some File Open / File Save dialogs were allowing -selection of all file types. e.g. Save Configuration As, Section of whistle -classifier training file, Map file Selection, These have now been changed so -that only the correct type of file can be selected.

+Bug 272. File types: Some File Open / File Save dialogs were allowing selection +of all file types. e.g. Save Configuration As, Section of whistle classifier +training file, Map file Selection, These have now been changed so that only the +correct type of file can be selected.

2.        @@ -3111,9 +3128,9 @@ option with caution !

5.              -The Open Office Database system has been removed from the list of -available options since it is not reliable. If you require a free database -solution we recommend you use the MySql Community Server The Open Office Database system has been removed from the list of available +options since it is not reliable. If you require a free database solution we +recommend you use the MySql Community Server http://dev.mysql.com/downloads/mysql/

'Multi Threading' menu item moved from 'Detection' (now 'Settings') to 'File'

-

'Start' and 'Stop' menu items removed. -PAMGuard should be started and stopped using the red and black buttons.

+

'Start' and 'Stop' menu items removed. PAMGuard +should be started and stopped using the red and black buttons.

New Modules

@@ -3374,9 +3391,9 @@ help for details.

Echo Detector and Sperm Whale IPI Computation (Beta only, Sound Measurements Group)

-

These two modules, developed by Brian Miller of the -Australian Antarctic Division can be used to estimate the inter pulse interval -of sperm whale clicks. (No help available)

+

These two modules, developed by Brian Miller of the Australian +Antarctic Division can be used to estimate the inter pulse interval of sperm +whale clicks. (No help available)

 

diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index e135ce29..36fc4eea 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -4,7 +4,7 @@ org.pamguard Pamguard Pamguard - 2.02.11d + 2.02.11f Pamguard using Maven to control dependencies www.pamguard.org diff --git a/pom.xml b/pom.xml index d09a31fd..2abb42ac 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.pamguard Pamguard - 2.02.11e + 2.02.11f Pamguard Pamguard using Maven to control dependencies www.pamguard.org diff --git a/src/PamController/PamController.java b/src/PamController/PamController.java index a114f266..b106a575 100644 --- a/src/PamController/PamController.java +++ b/src/PamController/PamController.java @@ -111,8 +111,8 @@ import PamguardMVC.debug.Debug; *

* PamController contains a list of PamControlledUnit's each of which * has it's own process, - simpleMapRef.gpsTextPanel.setPixelsPerMetre(getPixelsPerMetre()); input and output data and display (Tab Panel, - * Menus, etc.) + * simpleMapRef.gpsTextPanel.setPixelsPerMetre(getPixelsPerMetre()); + * input and output data and display (Tab Panel, Menus, etc.) * @see PamController.PamControlledUnit * @see PamView.PamTabPanel * @@ -129,7 +129,7 @@ public class PamController implements PamControllerInterface, PamSettings { public static final int PAM_COMPLETE = 6; public static final int PAM_MAPMAKING = 7; public static final int PAM_OFFLINETASK = 8; - + public static final int BUTTON_START = 1; public static final int BUTTON_STOP = 2; private volatile int lastStartStopButton = 0; @@ -145,20 +145,21 @@ public class PamController implements PamControllerInterface, PamSettings { public static final int RUN_NETWORKRECEIVER = 5; private int runMode = RUN_NORMAL; - - // flag used in main() to indicate that processing should start immediately. + + // flag used in main() to indicate that processing should start immediately. public static final String AUTOSTART = "-autostart"; - // flag used in main() to indicate that pamguard should exit as soon as processing ends. + // flag used in main() to indicate that pamguard should exit as soon as + // processing ends. public static final String AUTOEXIT = "-autoexit"; /** - * Never changed. Needed to identify settings for list of modules in prfx files. + * Never changed. Needed to identify settings for list of modules in prfx files. */ public static final String unitName = "Pamguard Controller"; public static final String unitType = "PamController"; /** - * The pam model. + * The pam model. */ private PamModel pamModelInterface; @@ -169,14 +170,14 @@ public class PamController implements PamControllerInterface, PamSettings { private volatile int pamStatus = PAM_IDLE; /** - * PamGuard view params. + * PamGuard view params. */ public PamViewParameters pamViewParameters = new PamViewParameters(); - // ViewerStatusBar viewerStatusBar; + // ViewerStatusBar viewerStatusBar; /* - * Swing GUI manager + * Swing GUI manager */ private PAMControllerGUI guiFrameManager; @@ -186,18 +187,17 @@ public class PamController implements PamControllerInterface, PamSettings { private boolean initializationComplete = false; /** - * The java version being run. e.g. Java 8u111 will be 8.111; + * The java version being run. e.g. Java 8u111 will be 8.111; */ - public static double JAVA_VERSION = getVersion (); - + public static double JAVA_VERSION = getVersion(); // PAMGUARD CREATION IS LAUNCHED HERE !!! - // private static PamControllerInterface anyController = new PamController(); + // private static PamControllerInterface anyController = new PamController(); private static PamController uniqueController; private Timer diagnosticTimer; - - private boolean debugDumpBufferAtRestart = true; + + private boolean debugDumpBufferAtRestart = false; private NetworkController networkController; private int nNetPrepared; @@ -207,67 +207,65 @@ public class PamController implements PamControllerInterface, PamSettings { private Timer garbageTimer; /** - * The UID manager. + * The UID manager. */ private UIDManager uidManager; /** - * A global time manager to manage corrections to the PC clock - * from various sources. + * A global time manager to manage corrections to the PC clock from various + * sources. */ private GlobalTimeManager globalTimeManager; /** - * A global medium manager which handles the type of medium sound is propogating through. + * A global medium manager which handles the type of medium sound is propogating + * through. */ - private GlobalMediumManager globalMediumManager; + private GlobalMediumManager globalMediumManager; /** - * A reference to the module currently being loaded. Used by the PamExceptionHandler to - * monitor runtime errors that occur during load + * A reference to the module currently being loaded. Used by the + * PamExceptionHandler to monitor runtime errors that occur during load */ - private static PamControlledUnit unitBeingLoaded=null; - + private static PamControlledUnit unitBeingLoaded = null; /** - * Folder where Pamguard is installed and running out of. This string - * includes the file separator at the end, or is null if there was a - * problem trying to determine the installation folder + * Folder where Pamguard is installed and running out of. This string includes + * the file separator at the end, or is null if there was a problem trying to + * determine the installation folder */ - private String installFolder=null; + private String installFolder = null; private boolean haveGlobalTimeUpdate; private WatchdogComms watchdogComms; - + private PamWarning statusWarning = new PamWarning("PAMGuard control", "Status", 0); - - /** + + /** * A separate thread that checks all ThreadedObservers to see if they still have * data in their buffers */ private Thread statusCheckThread; private WaitDetectorThread detectorEndThread; private boolean firstDataLoadComplete; - // keep a track of the total number of times PAMGuard is started for debug purposes. + // keep a track of the total number of times PAMGuard is started for debug + // purposes. private int nStarts; private RestartRunnable restartRunnable; - private PamController(int runMode, Object object) { uniqueController = this; - + pamConfiguration = new PamConfiguration(); this.runMode = runMode; if (runMode == PamController.RUN_PAMVIEW) { uidManager = new UIDViewerManager(this); - } - else { + } else { uidManager = new UIDOnlineManager(this); } - sayMemory(); globalTimeManager = new GlobalTimeManager(this); @@ -285,11 +283,12 @@ public class PamController implements PamControllerInterface, PamSettings { } guiFrameManager = PamGUIManager.createGUI(this, object); - guiFrameManager.init(); //perform any start up processes for the GUI. + guiFrameManager.init(); // perform any start up processes for the GUI. // figure out the installation folder try { - File theURL = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); + File theURL = new File( + this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); installFolder = theURL.getParentFile().getPath() + File.separator; } catch (URISyntaxException e) { System.out.println("Error finding installation folder of jar file: " + e.getMessage()); @@ -300,13 +299,12 @@ public class PamController implements PamControllerInterface, PamSettings { setupPamguard(); setupGarbageCollector(); - // if (PamGUIManager.getGUIType() == PamGUIManager.NOGUI) { // } - - // diagnosticTimer = new Timer(1000, new DiagnosticTimer()); - // diagnosticTimer.start(); + + // diagnosticTimer = new Timer(1000, new DiagnosticTimer()); + // diagnosticTimer.start(); } class DiagnosticTimer implements ActionListener { @@ -318,51 +316,51 @@ public class PamController implements PamControllerInterface, PamSettings { private void sayMemory() { Runtime r = Runtime.getRuntime(); - System.out.println(String.format("System memory at %s Max %d, Free %d", - PamCalendar.formatDateTime(System.currentTimeMillis()), - r.maxMemory(), r.freeMemory())); + System.out.println(String.format("System memory at %s Max %d, Free %d", + PamCalendar.formatDateTime(System.currentTimeMillis()), r.maxMemory(), r.freeMemory())); } /** - * Create an instance of the PAMController. + * Create an instance of the PAMController. + * * @param runMode - the run mode */ public static void create(int runMode) { if (uniqueController == null) { PamController pamcontroller = new PamController(runMode, null); /* - * I don't see any reason not have have this running with the GUI. - * It launches in a new thread, so it should be fine to have - * additional commands afterwards. + * I don't see any reason not have have this running with the GUI. It launches + * in a new thread, so it should be fine to have additional commands afterwards. */ TerminalController tc = new TerminalController(pamcontroller); tc.getTerminalCommands(); } - + SwingUtilities.invokeLater(new Runnable() { - + @Override public void run() { uniqueController.creationComplete(); } }); } - + /** - * Not to sound God like, but this will be called on the AWT dispatch thread shortly - * after all modules are created, PAMGuard should be fully setup and all modules will - * have recieved INITIALISATION_COMPLETE and should be good to run + * Not to sound God like, but this will be called on the AWT dispatch thread + * shortly after all modules are created, PAMGuard should be fully setup and all + * modules will have recieved INITIALISATION_COMPLETE and should be good to run */ private void creationComplete() { if (GlobalArguments.getParam(PamController.AUTOSTART) != null) { startLater(); // may as well give AWT time to loop it's queue once more } } - + /** - * Create an instance of the PAMcController. + * Create an instance of the PAMcController. + * * @param runMode - the run mode - * @param object - extra information. Can be null. + * @param object - extra information. Can be null. */ public static void create(int runMode, Object object) { if (uniqueController == null) { @@ -371,21 +369,20 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Setup the PAMController. + * Setup the PAMController. */ public void setupPamguard() { /** - * Set Locale to English so that formated writes to text fields - * in dialogs use . and not , for the decimal. + * Set Locale to English so that formated writes to text fields in dialogs use . + * and not , for the decimal. */ Locale.setDefault(Locale.ENGLISH); /* - * 15/8/07 Changed creation order of model and view. - * Need to be able to create a database pretty early on - * (in the Model) in order to read back settings that - * the GUI may require. + * 15/8/07 Changed creation order of model and view. Need to be able to create a + * database pretty early on (in the Model) in order to read back settings that + * the GUI may require. * */ // create the model @@ -393,39 +390,42 @@ public class PamController implements PamControllerInterface, PamSettings { pamModelInterface.createPamModel(); /* - * 9 February 2009 - * Trying to sort out settings file loading. - * Was previously done when the first modules registered itself - * with the settings manager. Gets very confusing. Will be much easier - * to load up the settings first, depending on the type of module - * and then have them ready when the modules start asking for them. + * 9 February 2009 Trying to sort out settings file loading. Was previously done + * when the first modules registered itself with the settings manager. Gets very + * confusing. Will be much easier to load up the settings first, depending on + * the type of module and then have them ready when the modules start asking for + * them. */ int loadAns = PamSettingManager.getInstance().loadPAMSettings(runMode); - - System.out.println("Pamcontroller: loadPAMSettings: " + loadAns); + + System.out.println("Pamcontroller: loadPAMSettings: " + loadAns); if (loadAns == PamSettingManager.LOAD_SETTINGS_NEW) { - // if (runMode == RUN_PAMVIEW) { - // // no model, no gui, so PAMGAURD will simply exit. - // String str = String.format("PAMGUARD cannot run in %s mode without a valid database\nPAMGUARD will exit.", - // getRunModeName()); - // str = "You have opened a database in viewer mode that contains no settings\n" + - // "Either load settings from the binary store, import a psf settings file or create modules by hand.\n" + - // "Press OK to continue or Cancel to exit the viewer"; + // if (runMode == RUN_PAMVIEW) { + // // no model, no gui, so PAMGAURD will simply exit. + // String str = String.format("PAMGUARD cannot run in %s mode without a valid + // database\nPAMGUARD will exit.", + // getRunModeName()); + // str = "You have opened a database in viewer mode that contains no settings\n" + // + + // "Either load settings from the binary store, import a psf settings file or + // create modules by hand.\n" + + // "Press OK to continue or Cancel to exit the viewer"; // - // int ans = JOptionPane.showConfirmDialog(null, str, "PAMGuard viewer", JOptionPane.OK_CANCEL_OPTION); - // if (ans == JOptionPane.CANCEL_OPTION) { - // System.exit(0); - // } - // } - // else if (loadAns == ){ - // // normal settings will probably return an error, but it's OK still ! - //// System.exit(0); - // } - // return; - } - else if (loadAns == PamSettingManager.LOAD_SETTINGS_CANCEL) { - JOptionPane.showMessageDialog(null, "No settings loaded. PAMGuard will exit", "PAMGuard", JOptionPane.INFORMATION_MESSAGE); + // int ans = JOptionPane.showConfirmDialog(null, str, "PAMGuard viewer", + // JOptionPane.OK_CANCEL_OPTION); + // if (ans == JOptionPane.CANCEL_OPTION) { + // System.exit(0); + // } + // } + // else if (loadAns == ){ + // // normal settings will probably return an error, but it's OK still ! + //// System.exit(0); + // } + // return; + } else if (loadAns == PamSettingManager.LOAD_SETTINGS_CANCEL) { + JOptionPane.showMessageDialog(null, "No settings loaded. PAMGuard will exit", "PAMGuard", + JOptionPane.INFORMATION_MESSAGE); System.exit(0); } @@ -434,44 +434,53 @@ public class PamController implements PamControllerInterface, PamSettings { } // get the general settings out of the file immediately. - // PamSettingManager.getInstance().loadSettingsFileData(); + // PamSettingManager.getInstance().loadSettingsFileData(); /* - * prepare to add a database to the model. - * this will then re-read it's settings from the - * settings file - which we dont' want yet !!!!! - * But now we have the database, it should be possible to - * alter the code that reads in all settings from a selected - * file and alter it so it gets them from the db instead. - * Then remove this database module immediately - * and let Pamguard create a new one based on the settings ! + * prepare to add a database to the model. this will then re-read it's settings + * from the settings file - which we dont' want yet !!!!! But now we have the + * database, it should be possible to alter the code that reads in all settings + * from a selected file and alter it so it gets them from the db instead. Then + * remove this database module immediately and let Pamguard create a new one + * based on the settings ! */ - // PamModuleInfo mi = PamModuleInfo.findModuleInfo("generalDatabase.DBControl"); - // PamControlledUnitSettings dbSettings = PamSettingManager.getInstance().findGeneralSettings(DBControl.getDbUnitType()); - // if (mi != null) { - // addModule(mi, "Temporary Database"); - // } + // PamModuleInfo mi = PamModuleInfo.findModuleInfo("generalDatabase.DBControl"); + // PamControlledUnitSettings dbSettings = + // PamSettingManager.getInstance().findGeneralSettings(DBControl.getDbUnitType()); + // if (mi != null) { + // addModule(mi, "Temporary Database"); + // } - // Add a note to the output console for the user to ignore the SLF4J warning (see http://www.slf4j.org/codes.html#StaticLoggerBinder - // for details). I spent a few hours trying to get rid of this warning, but without any luck. If you do a google search - // there are a lot of forum suggestions on how to fix, but none seemed to work for me. Added both slf4j-nop and - // slf4j-simple to dependency list, neither made a difference. Changed order of dependencies, ran purges and updates, - // added slf4j-api explicitly, made sure I don't have duplicate bindings, but nothing helped. - // + // Add a note to the output console for the user to ignore the SLF4J warning + // (see http://www.slf4j.org/codes.html#StaticLoggerBinder + // for details). I spent a few hours trying to get rid of this warning, but + // without any luck. If you do a google search + // there are a lot of forum suggestions on how to fix, but none seemed to work + // for me. Added both slf4j-nop and + // slf4j-simple to dependency list, neither made a difference. Changed order of + // dependencies, ran purges and updates, + // added slf4j-api explicitly, made sure I don't have duplicate bindings, but + // nothing helped. + // // Error occurs when PamDataBlock.sortTypeInformation() calls - // superDetectionClass = GenericTypeResolver.resolveReturnType(method, unitClass); (currently line 397). I don't want - // to add the note there because that gets called every time a PamDataBlock is created. So I add the note here, which + // superDetectionClass = GenericTypeResolver.resolveReturnType(method, + // unitClass); (currently line 397). I don't want + // to add the note there because that gets called every time a PamDataBlock is + // created. So I add the note here, which // is just before the error occurs // - // Oddly enough, this warning DOES NOT occur when running the non-Maven version (Java12 branch). The dependencies in the - // classpath are the same as the ones here in Maven, so I don't know what to say. + // Oddly enough, this warning DOES NOT occur when running the non-Maven version + // (Java12 branch). The dependencies in the + // classpath are the same as the ones here in Maven, so I don't know what to + // say. System.out.println(""); - System.out.println("Note - ignore the following SLF4J warn/error messages, they are not applicable to this application"); + System.out.println( + "Note - ignore the following SLF4J warn/error messages, they are not applicable to this application"); ArrayManager.getArrayManager(); // create the array manager so that it get's it's settings MetaDataContol.getMetaDataControl(); /** - * Check for archived files and unpack automatically. + * Check for archived files and unpack automatically. */ if (runMode == RUN_PAMVIEW && SMRUEnable.isEnable()) { ZipUnpacker zipUnpacker = new ZipUnpacker(this); @@ -499,34 +508,34 @@ public class PamController implements PamControllerInterface, PamSettings { // } // } - /* * We are running as a remote application, start process straight away! */ if (PamSettingManager.RUN_REMOTE == false) { - addView(guiFrameManager.initPrimaryView(this, pamModelInterface)); + addView(guiFrameManager.initPrimaryView(this, pamModelInterface)); } /** - * Calling this will cause a callback to this.restoreSettings which - * includes a list of modules which will then get created, and in turn - * load all of their own settings from the settings manager. + * Calling this will cause a callback to this.restoreSettings which includes a + * list of modules which will then get created, and in turn load all of their + * own settings from the settings manager. */ PamSettingManager.getInstance().registerSettings(this); - + /** - * For offline batch processing a few funnies happen here. We'll be open - * in viewer mode, but it's likely a psf will have been passed as an input argument. - * We will therefore have to extract all the modules from that psfx as well and either - * add them as new modules, or get their settings and use those to update existing settings - * That should probably be done here before the final calls to setup processes, etc. + * For offline batch processing a few funnies happen here. We'll be open in + * viewer mode, but it's likely a psf will have been passed as an input + * argument. We will therefore have to extract all the modules from that psfx as + * well and either add them as new modules, or get their settings and use those + * to update existing settings That should probably be done here before the + * final calls to setup processes, etc. */ if (getRunMode() == RUN_PAMVIEW && PamSettingManager.remote_psf != null) { loadOtherSettings(PamSettingManager.remote_psf); } /* - * Get any other required modules for this run mode. + * Get any other required modules for this run mode. */ pamModelInterface.startModel(); @@ -537,107 +546,110 @@ public class PamController implements PamControllerInterface, PamSettings { */ if (getRunMode() == RUN_NOTHING) { - }else if (PamSettingManager.RUN_REMOTE == true) { + } else if (PamSettingManager.RUN_REMOTE == true) { // Initialisation is complete. initializationComplete = true; notifyModelChanged(PamControllerInterface.INITIALIZATION_COMPLETE); System.out.println("Starting Pamguard in REMOTE execution mode."); pamStart(); - }else{ + } else { - // if (getRunMode() == RUN_PAMVIEW) { - // createViewerStatusBar(); - // } + // if (getRunMode() == RUN_PAMVIEW) { + // createViewerStatusBar(); + // } - // call before initialisation complete, so that processes can re-do. + // call before initialisation complete, so that processes can re-do. createAnnotations(); organiseGUIFrames(); - //sort the frame titles (Swing convenience) - if (PamGUIManager.isSwing()) sortFrameTitles(); + // sort the frame titles (Swing convenience) + if (PamGUIManager.isSwing()) + sortFrameTitles(); initializationComplete = true; notifyModelChanged(PamControllerInterface.INITIALIZATION_COMPLETE); /** - * Trigger loading of relationships between markers and mark observers. - * No need to do anything more than call the constructor and - * everything else will happen... + * Trigger loading of relationships between markers and mark observers. No need + * to do anything more than call the constructor and everything else will + * happen... */ - MarkRelationships.getInstance(); + MarkRelationships.getInstance(); } if (getRunMode() == RUN_PAMVIEW) { /** - * Tell any modules implementing OfflineDataSource to check - * their maps. + * Tell any modules implementing OfflineDataSource to check their maps. */ AWTScheduler.getInstance().scheduleTask(new DataInitialised()); - // PamControlledUnit pcu; - // OfflineDataSource offlineDataSource; - // for (int iU = 0; iU < pamControlledUnits.size(); iU++) { - // pcu = pamControlledUnits.get(iU); - // if (OfflineDataSource.class.isAssignableFrom(pcu.getClass())) { - // offlineDataSource = (OfflineDataSource) pcu; - // offlineDataSource.createOfflineDataMap(null); - // } - // } + // PamControlledUnit pcu; + // OfflineDataSource offlineDataSource; + // for (int iU = 0; iU < pamControlledUnits.size(); iU++) { + // pcu = pamControlledUnits.get(iU); + // if (OfflineDataSource.class.isAssignableFrom(pcu.getClass())) { + // offlineDataSource = (OfflineDataSource) pcu; + // offlineDataSource.createOfflineDataMap(null); + // } + // } - // PamSettingManager.getInstance().registerSettings(new ViewTimesSettings()); - // getNewViewTimes(null); + // PamSettingManager.getInstance().registerSettings(new ViewTimesSettings()); + // getNewViewTimes(null); } uidManager.runStartupChecks(); - + clearSelectorsAndSymbols(); - /** - * Debug code for starting PG as soon as it's initialised. + * Debug code for starting PG as soon as it's initialised. */ - // SwingUtilities.invokeLater(new Runnable() { - // @Override - // public void run() { - // pamStart(); - // } - // }); + // SwingUtilities.invokeLater(new Runnable() { + // @Override + // public void run() { + // pamStart(); + // } + // }); } - /** - * Clear all data selectors and symbol managers. Required since some of these will have loaded as various modules were created, - * but may also require additional data selectors and symbol managers from super detections which were not availble. - * Deleting the lot, will cause them to be recreated as soon as they are next needed. - * Should probably also call these on any call to addModule as well ? + * Clear all data selectors and symbol managers. Required since some of these + * will have loaded as various modules were created, but may also require + * additional data selectors and symbol managers from super detections which + * were not availble. Deleting the lot, will cause them to be recreated as soon + * as they are next needed. Should probably also call these on any call to + * addModule as well ? */ - private void clearSelectorsAndSymbols() { + private void clearSelectorsAndSymbols() { DataSelectorCreator.globalClear(); PamSymbolManager.globalClear(); - + } /** - * This gets called after other data initialisation tasks (such as data mapping). + * This gets called after other data initialisation tasks (such as data + * mapping). + * * @author dg50 * */ class DataInitialised implements Runnable { @Override public void run() { - notifyModelChanged(PamControllerInterface.INITIALIZE_LOADDATA); - // tell all scrollers to reload their data. - // loadViewerData(); + notifyModelChanged(PamControllerInterface.INITIALIZE_LOADDATA); + // tell all scrollers to reload their data. + // loadViewerData(); } } - /** * Called when the number of Networked remote stations changes so that the - * receiver can make a decision as to what to do in terms of - * preparing detectors, opening files, etc. - * @param timeMilliseconds - * @param nPrepared number of remote stations currently prepared (called just before start) - * @param nStarted number of remote stations currently started - * @param nStopped number of remote stations currently stopped + * receiver can make a decision as to what to do in terms of preparing + * detectors, opening files, etc. + * + * @param timeMilliseconds + * @param nPrepared number of remote stations currently prepared (called + * just before start) + * @param nStarted number of remote stations currently started + * @param nStopped number of remote stations currently stopped */ public void netReceiveStatus(long timeMilliseconds, int nPrepared, int nStarted, int nStopped) { if (this.nNetStarted == 0 && nStarted >= 1) { @@ -653,9 +665,10 @@ public class PamController implements PamControllerInterface, PamSettings { this.nNetStarted = nStarted; this.nNetStopped = nStopped; } + /** - * Loop through all controllers and processes and datablocks and set up all - * of their annotations. + * Loop through all controllers and processes and datablocks and set up all of + * their annotations. */ private void createAnnotations() { PamControlledUnit pcu; @@ -672,32 +685,31 @@ public class PamController implements PamControllerInterface, PamSettings { if (pp.getSourceDataBlock() == null) { pp.createAnnotations(true); } - // nPdb = pp.getNumOutputDataBlocks(); - // for (int iPdb = 0; iPdb < nPdb; iPdb++) { - // pdb = pp.getOutputDataBlock(iPdb); - // pdb.createAnnotations(pp.getSourceDataBlock(), pp); - // } + // nPdb = pp.getNumOutputDataBlocks(); + // for (int iPdb = 0; iPdb < nPdb; iPdb++) { + // pdb = pp.getOutputDataBlock(iPdb); + // pdb.createAnnotations(pp.getSourceDataBlock(), pp); + // } } } } /** - * Organise the GUI frames on start up or after a module was added - * or after the frames menus have changed. + * Organise the GUI frames on start up or after a module was added or after the + * frames menus have changed. */ private void organiseGUIFrames() { } - - // private void createViewerStatusBar() { - // - // viewerStatusBar = new ViewerStatusBar(this); - // PamStatusBar.getStatusBar().getToolBar().setLayout(new BorderLayout()); - // PamStatusBar.getStatusBar().getToolBar().add(BorderLayout.CENTER, - // viewerStatusBar.getStatusBarComponent()); - // } + // private void createViewerStatusBar() { + // + // viewerStatusBar = new ViewerStatusBar(this); + // PamStatusBar.getStatusBar().getToolBar().setLayout(new BorderLayout()); + // PamStatusBar.getStatusBar().getToolBar().add(BorderLayout.CENTER, + // viewerStatusBar.getStatusBarComponent()); + // } void setupProcesses() { // for (int i = 0; i < pamControlledUnits.size(); i++) { @@ -707,28 +719,26 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Can PAMGUARD shut down. This question is asked in turn to - * every module. Each module should attempt to make sure it can - * answer true, e.g. by closing files, but if any module - * returns false, then canClose() will return false; - * @return whether it's possible to close PAMGUARD - * without corrupting or losing data. + * Can PAMGUARD shut down. This question is asked in turn to every module. Each + * module should attempt to make sure it can answer true, e.g. by closing files, + * but if any module returns false, then canClose() will return false; + * + * @return whether it's possible to close PAMGUARD without corrupting or losing + * data. */ public boolean canClose() { return pamConfiguration.canClose(); } - /** - * Called after canClose has returned true to finally tell - * all modules that PAMGUARD is definitely closing down.so they - * can free any resources, etc. + * Called after canClose has returned true to finally tell all modules that + * PAMGUARD is definitely closing down.so they can free any resources, etc. */ @Override public void pamClose() { getUidManager().runShutDownOps(); - + pamConfiguration.pamClose(); } @@ -736,24 +746,25 @@ public class PamController implements PamControllerInterface, PamSettings { * Shut down Pamguard */ public void shutDownPamguard() { - // force close the javaFX thread (because it won't close by itself - see Platform.setImplicitExit(false) in constructor + // force close the javaFX thread (because it won't close by itself - see + // Platform.setImplicitExit(false) in constructor Platform.exit(); - + // terminate the JVM System.exit(getPamStatus()); } /** - * Go through all data blocks in all modules and tell them to save. - * This has been built into PamProcess and PamDataBlock since we want - * it to be easy to override this for specific modules / processes / data blocks. + * Go through all data blocks in all modules and tell them to save. This has + * been built into PamProcess and PamDataBlock since we want it to be easy to + * override this for specific modules / processes / data blocks. */ public void saveViewerData() { ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); for (int i = 0; i < pamControlledUnits.size(); i++) { pamControlledUnits.get(i).saveViewerData(); } - // Commit the database. + // Commit the database. DBControlUnit dbControl = DBControlUnit.findDatabaseControl(); if (dbControl != null) { dbControl.commitChanges(); @@ -762,7 +773,7 @@ public class PamController implements PamControllerInterface, PamSettings { @Override public void addControlledUnit(PamControlledUnit controlledUnit) { - + pamConfiguration.addControlledUnit(controlledUnit); guiFrameManager.addControlledUnit(controlledUnit); @@ -773,78 +784,87 @@ public class PamController implements PamControllerInterface, PamSettings { @Override public PamControlledUnit addModule(Frame parentFrame, PamModuleInfo moduleInfo) { // first of all we need to get a name for the new module - // String question = "Enter a name for the new " + moduleInfo.getDescription(); - // String newName = JOptionPane.showInputDialog(null, question, - // "New " + moduleInfo.getDescription(), JOptionPane.OK_CANCEL_OPTION); - //String newName = NewModuleDialog.showDialog(parentFrame ,moduleInfo,null); - String newName = guiFrameManager.getModuleName(parentFrame, moduleInfo); + // String question = "Enter a name for the new " + moduleInfo.getDescription(); + // String newName = JOptionPane.showInputDialog(null, question, + // "New " + moduleInfo.getDescription(), JOptionPane.OK_CANCEL_OPTION); + // String newName = NewModuleDialog.showDialog(parentFrame ,moduleInfo,null); + String newName = guiFrameManager.getModuleName(parentFrame, moduleInfo); - if (newName == null) return null; + if (newName == null) + return null; return addModule(moduleInfo, newName); } /** - * Add a module to the controller. + * Add a module to the controller. + * * @param moduleInfo - the module info i.e. the type of module to add - * @param moduleName - the module name. + * @param moduleName - the module name. * @return */ public PamControlledUnit addModule(PamModuleInfo moduleInfo, String moduleName) { - // Comment this section out and replace with code below, to provide custom error handling with PamExceptionHandler - // PamControlledUnit pcu = moduleInfo.create(moduleName); - // if (pcu == null) return null; - // addControlledUnit(pcu); - // if (initializationComplete) { - // pcu.setupControlledUnit(); - // } - // return pcu; + // Comment this section out and replace with code below, to provide custom error + // handling with PamExceptionHandler + // PamControlledUnit pcu = moduleInfo.create(moduleName); + // if (pcu == null) return null; + // addControlledUnit(pcu); + // if (initializationComplete) { + // pcu.setupControlledUnit(); + // } + // return pcu; - // try to load the unit. If moduleInfo.create returns null, clear the name and exit. Otherwise, save + // try to load the unit. If moduleInfo.create returns null, clear the name and + // exit. Otherwise, save // the name of the module being loaded unitBeingLoaded = moduleInfo.create(moduleName); if (unitBeingLoaded == null) { return null; } - // try to add the unit to the list. + // try to add the unit to the list. // Put this method call in a try/catch, in case the developer hasn't coded - // the plugin properly. We need to catch Throwable, not Exception, in order + // the plugin properly. We need to catch Throwable, not Exception, in order // to catch everything (e.g. if one of the abstract methods is missing, java - // throws AbstractMethodError. This is an error, not an exception, so if - // we want to catch it we need to catch Throwable. Same with a ClassDefNotFoundError, + // throws AbstractMethodError. This is an error, not an exception, so if + // we want to catch it we need to catch Throwable. Same with a + // ClassDefNotFoundError, // in case the plugin is looking for a class in the Pamguard core that no longer // exists). // Also check if unitBeingLoaded=null afterwards because this would indicate - // that the PamExceptionHandler caught a runtime error during the class instantiation and therefore - // removed the module to prevent further errors. This could also happen due to incompatibilities between + // that the PamExceptionHandler caught a runtime error during the class + // instantiation and therefore + // removed the module to prevent further errors. This could also happen due to + // incompatibilities between // the current version of Pamguard and older plugin modules. try { addControlledUnit(unitBeingLoaded); } catch (Throwable e) { e.printStackTrace(); String title = "Error adding module"; - String msg = "There is an error with the module " + moduleName + ".

" + - "If this is a plug-in, the error may have been caused by an incompatibility between " + - "it and this version of PAMGuard. Please check the developer's website " + - "for help.

" + - "If this is a core Pamguard module, please copy the error message text and email to" + - "support@pamguard.org.

" + - "This module will not be loaded."; + String msg = "There is an error with the module " + moduleName + ".

" + + "If this is a plug-in, the error may have been caused by an incompatibility between " + + "it and this version of PAMGuard. Please check the developer's website " + "for help.

" + + "If this is a core Pamguard module, please copy the error message text and email to" + + "support@pamguard.org.

" + "This module will not be loaded."; String help = null; int ans = WarnOnce.showWarning(title, msg, WarnOnce.WARNING_MESSAGE, help, e); - System.err.println("Exception while loading " + moduleName); + System.err.println("Exception while loading " + moduleName); this.removeControlledUnt(unitBeingLoaded); - this.clearLoadedUnit();; + this.clearLoadedUnit(); + ; } if (unitBeingLoaded == null) { return null; } - // run the unit's setupProcess method. Again, check if nitBeingLoaded=null afterwards because this would indicate - // that the PamExceptionHandler caught a runtime error during the class instantiation and therefore - // removed the module to prevent further errors. This could happen due to incompatibilities between + // run the unit's setupProcess method. Again, check if nitBeingLoaded=null + // afterwards because this would indicate + // that the PamExceptionHandler caught a runtime error during the class + // instantiation and therefore + // removed the module to prevent further errors. This could happen due to + // incompatibilities between // the current version of Pamguard and older plugin modules. if (initializationComplete) { unitBeingLoaded.setupControlledUnit(); @@ -855,33 +875,38 @@ public class PamController implements PamControllerInterface, PamSettings { // move the controlled unit reference to a temp variable, so that we can // clear the unitBeingLoaded variable and still pass a reference to the - // new unit back to the calling function. In this way, we can always use + // new unit back to the calling function. In this way, we can always use // the unitBeingLoaded variable as a de facto flag to know whether or not // a module is currently being loaded PamControlledUnit unitNowLoaded = unitBeingLoaded; clearLoadedUnit(); - // guiFrameManager.notifyModelChanged(ADD_CONTROLLEDUNIT); //this should be handled above in addControlledUnit + // guiFrameManager.notifyModelChanged(ADD_CONTROLLEDUNIT); //this should be + // handled above in addControlledUnit return unitNowLoaded; } - /* (non-Javadoc) - * @see PamguardMVC.PamControllerInterface#RemoveControlledUnt(PamguardMVC.PamControlledUnit) + /* + * (non-Javadoc) + * + * @see PamguardMVC.PamControllerInterface#RemoveControlledUnt(PamguardMVC. + * PamControlledUnit) */ @Override public void removeControlledUnt(PamControlledUnit controlledUnit) { // The PamExceptionHandler will call this to remove a controlled unit that fails - // during load. Depending when it failed, it may or may not have been instantiated - // yet. So if the controlledUnit is still null, just exit - // - if (controlledUnit==null) { + // during load. Depending when it failed, it may or may not have been + // instantiated + // yet. So if the controlledUnit is still null, just exit + // + if (controlledUnit == null) { return; } /** - * NEVER delete the array manager. + * NEVER delete the array manager. */ if (controlledUnit.getClass() == ArrayManager.class) { return; @@ -893,17 +918,19 @@ public class PamController implements PamControllerInterface, PamSettings { if (removed) { notifyModelChanged(PamControllerInterface.REMOVE_CONTROLLEDUNIT); } - // getMainFrame().revalidate(); //handled inside the GUIFrameManager by notify model changed. The controller should have - //as few direct GUI calls as possible. + // getMainFrame().revalidate(); //handled inside the GUIFrameManager by notify + // model changed. The controller should have + // as few direct GUI calls as possible. } - - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see PamController.PamControllerInterface#orderModules() */ @Override public boolean orderModules(Frame parentFrame) { - int[] newOrder = ModuleOrderDialog.showDialog(this, parentFrame); + int[] newOrder = ModuleOrderDialog.showDialog(this, parentFrame); if (newOrder != null) { // re-order the modules according the new list. pamConfiguration.reOrderModules(newOrder); @@ -934,8 +961,9 @@ public class PamController implements PamControllerInterface, PamSettings { // } /** - * Swaps the positions of two modules in the main list of modules and - * also swaps their tabs (if they have them). + * Swaps the positions of two modules in the main list of modules and also swaps + * their tabs (if they have them). + * * @param m1 First PamControlledUnit to swap * @param m2 Second PamControlledUnit to swap. */ @@ -944,8 +972,9 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Sets the position of a particular PamControlledUnit in the list. - * Also sets the right tab position, to match that order. + * Sets the position of a particular PamControlledUnit in the list. Also sets + * the right tab position, to match that order. + * * @param pcu * @param position * @return @@ -967,17 +996,21 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Get a list of PamControlledUnit units of a given type + * * @param unitType Controlled unit type - * @return list of units. + * @return list of units. */ public ArrayList findControlledUnits(String unitType) { return pamConfiguration.findControlledUnits(unitType); } + /** - * Get a list of PamControlledUnit units of a given type and name, allowing for nulls. + * Get a list of PamControlledUnit units of a given type and name, allowing for + * nulls. + * * @param unitType Controlled unit type, can be null for all units of name * @param unitName Controlled unit name, can be null for all units of type - * @return list of units. + * @return list of units. */ public ArrayList findControlledUnits(String unitType, String unitName) { return pamConfiguration.findControlledUnits(unitType, unitName); @@ -990,37 +1023,45 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Find the first instance of a module with a given class type and name. - *

Name can be null in which case the first module with the correct class - * will be returned + *

+ * Name can be null in which case the first module with the correct class will + * be returned + * * @param unitClass Module class (sub class of PamControlledUnit) - * @param unitName Module Name - * @return Existing module with that class and name. + * @param unitName Module Name + * @return Existing module with that class and name. */ public PamControlledUnit findControlledUnit(Class unitClass, String unitName) { return pamConfiguration.findControlledUnit(unitClass, unitName); } /** - * Get an Array list of PamControlledUnits of a particular class (exact matches only). + * Get an Array list of PamControlledUnits of a particular class (exact matches + * only). + * * @param unitClass PamControlledUnit class - * @return List of current instances of this class. + * @return List of current instances of this class. */ public ArrayList findControlledUnits(Class unitClass) { return pamConfiguration.findControlledUnits(unitClass); } - + /** - * Get an Array list of PamControlledUnits of a particular class (exact matches only). + * Get an Array list of PamControlledUnits of a particular class (exact matches + * only). + * * @param unitClass PamControlledUnit class - * @return List of current instances of this class. + * @return List of current instances of this class. */ public ArrayList findControlledUnits(Class unitClass, boolean includeSubClasses) { return pamConfiguration.findControlledUnits(unitClass, includeSubClasses); } /** - * Check whether a controlled unit exists based on it's name. - * @param the controlled unit name e.g. "my crazy click detector", not the default name. + * Check whether a controlled unit exists based on it's name. + * + * @param the controlled unit name e.g. "my crazy click detector", not the + * default name. */ public boolean isControlledUnit(String controlName) { return pamConfiguration.isControlledUnit(controlName); @@ -1049,17 +1090,15 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Restart PAMguard. Can be called when something is mildly wrong - * such as a DAQ glitch, so that acquisition is stopped and - * restarted. + * Restart PAMguard. Can be called when something is mildly wrong such as a DAQ + * glitch, so that acquisition is stopped and restarted. */ public void restartPamguard() { pamStop(); - + /* - * launch a restart thread, that won't do ANYTHING until - * PAMGuard is really idle and buffers are cleared. Can only - * have one of these at a time ! + * launch a restart thread, that won't do ANYTHING until PAMGuard is really idle + * and buffers are cleared. Can only have one of these at a time ! */ if (restartRunnable != null) { System.out.println("Warning !!!! PAMGuard is already trying to restart!"); @@ -1069,7 +1108,7 @@ public class PamController implements PamControllerInterface, PamSettings { Thread restartThread = new Thread(restartRunnable, "RestartPAMGuard Thread"); restartThread.run(); } - + private class RestartRunnable implements Runnable { @Override @@ -1084,20 +1123,16 @@ public class PamController implements PamControllerInterface, PamSettings { } long t2 = System.currentTimeMillis(); restartRunnable = null; - System.out.printf("PAMGuard safe to restart after %d milliseconds\n", t2-t1); - startLater(false); - + System.out.printf("PAMGuard safe to restart after %d milliseconds\n", t2 - t1); + startLater(false); + } - + } - - - - + /** - * calls pamStart using the SwingUtilities - * invokeLater command to start PAMGAURD - * later in the AWT event queue. + * calls pamStart using the SwingUtilities invokeLater command to start PAMGAURD + * later in the AWT event queue. */ public void startLater() { // SwingUtilities.invokeLater(new StartLater(true)); @@ -1107,8 +1142,10 @@ public class PamController implements PamControllerInterface, PamSettings { public void startLater(boolean saveSettings) { SwingUtilities.invokeLater(new StartLater(saveSettings)); } + /** - * Runnable for use with startLater. + * Runnable for use with startLater. + * * @author Doug * */ @@ -1127,8 +1164,8 @@ public class PamController implements PamControllerInterface, PamSettings { @Override public void run() { /* - * do a final check that the stop button hasn't been pressed - can arrive a bit - * late if the system was continually restarting. + * do a final check that the stop button hasn't been pressed - can arrive a bit + * late if the system was continually restarting. */ if (lastStartStopButton != BUTTON_STOP) { pamStart(saveSettings); @@ -1137,9 +1174,8 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * calls pamStop using the SwingUtilities - * invokeLater command to stop PAMGAURD - * later in the AWT event queue. + * calls pamStop using the SwingUtilities invokeLater command to stop PAMGAURD + * later in the AWT event queue. */ public void stopLater() { SwingUtilities.invokeLater(new StopLater()); @@ -1147,6 +1183,7 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Runnable to use with the stopLater() command + * * @author Doug Gillespie * */ @@ -1158,8 +1195,9 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Called from the start button. A little book keeping - * to distinguish this from automatic starts / restarts + * Called from the start button. A little book keeping to distinguish this from + * automatic starts / restarts + * * @return true if started. */ @Override @@ -1167,10 +1205,10 @@ public class PamController implements PamControllerInterface, PamSettings { lastStartStopButton = BUTTON_START; return pamStart(); } - + /** - * Called from the stop button. A little book keeping - * to distinguish this from automatic starts / restarts + * Called from the stop button. A little book keeping to distinguish this from + * automatic starts / restarts */ @Override public void manualStop() { @@ -1180,45 +1218,49 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Start PAMGUARD. This function also gets called from the - * GUI menu start button and from the Network control system. - *

As well as actually starting PAMGUARD it will write - * settings to the database and to the binary data store. + * Start PAMGUARD. This function also gets called from the GUI menu start button + * and from the Network control system. + *

+ * As well as actually starting PAMGUARD it will write settings to the database + * and to the binary data store. + * * @return true if all modules start successfully */ @Override public boolean pamStart() { - // Debug.println("PAMController: pamStart"); + // Debug.println("PAMController: pamStart"); setManualStop(false); return pamStart(true); } /** - * Start PAMGuard with an option on saving settings. + * Start PAMGuard with an option on saving settings. + * * @param saveSettings flag to save settings to database and binary store * @return true if all modules start successfully */ public boolean pamStart(boolean saveSettings) { - // Debug.println("PAMController: pamStart2"); + // Debug.println("PAMController: pamStart2"); return pamStart(saveSettings, PamCalendar.getTimeInMillis()); } /** - * Starts PAMGuard, but with the option to save settings (to binary and to database) - * and also to give a specific start time for the session. When data are being received over - * the network, this may be in the past ! - * @param saveSettings flag to say whether or not settings should be saved. - * @param startTime start time in millis + * Starts PAMGuard, but with the option to save settings (to binary and to + * database) and also to give a specific start time for the session. When data + * are being received over the network, this may be in the past ! + * + * @param saveSettings flag to say whether or not settings should be saved. + * @param startTime start time in millis * @return true if all modules start successfully */ public boolean pamStart(boolean saveSettings, long startTime) { - // Debug.println("PAMController: pamStart3"); + // Debug.println("PAMController: pamStart3"); - globalTimeManager.waitForGlobalTime(getMainFrame(), + globalTimeManager.waitForGlobalTime(getMainFrame(), globalTimeManager.getGlobalTimeParameters().getStartupDelay()); manualStop = false; - + ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); PamCalendar.setSessionStartTime(startTime); @@ -1232,14 +1274,16 @@ public class PamController implements PamControllerInterface, PamSettings { } if (pamControlledUnits.get(iU).getPamProcess(iP).prepareProcessOK() == false) { setPamStatus(PAM_IDLE); - System.out.println("Can't start since unable to prepare process " + - pamControlledUnits.get(iU).getPamProcess(iP).getProcessName()); + System.out.println("Can't start since unable to prepare process " + + pamControlledUnits.get(iU).getPamProcess(iP).getProcessName()); prepErrors++; - }; + } + ; } - // long t2 = System.currentTimeMillis(); - // System.out.printf("***********************************Time taken to prepare %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), t2-t1); - // t1 = t2; + // long t2 = System.currentTimeMillis(); + // System.out.printf("***********************************Time taken to prepare + // %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), t2-t1); + // t1 = t2; } boolean prepError = (runMode == PamController.RUN_NORMAL && prepErrors > 0); if (prepError) { @@ -1248,15 +1292,16 @@ public class PamController implements PamControllerInterface, PamSettings { /* * - * This needs to be called after prepareproces. - * Now we do some extra checks on the stores to see if we want to overwite data, - * carry on from where we left off, etc. + * This needs to be called after prepareproces. Now we do some extra checks on + * the stores to see if we want to overwite data, carry on from where we left + * off, etc. */ - if (saveSettings && getRunMode() == RUN_NORMAL) { // only true on a button press or network start. + if (saveSettings && getRunMode() == RUN_NORMAL) { // only true on a button press or network start. ReprocessManager reprocessManager = new ReprocessManager(); boolean goonthen = reprocessManager.checkOutputDataStatus(); if (goonthen == false) { - System.out.println("Data processing will not start since you've chosen not to overwrite existing output data"); + System.out.println( + "Data processing will not start since you've chosen not to overwrite existing output data"); pamStop(); setPamStatus(PAM_IDLE); return false; @@ -1270,7 +1315,8 @@ public class PamController implements PamControllerInterface, PamSettings { } if (++nStarts > 1 && debugDumpBufferAtRestart) { - // do this here - all processses should have reset buffers to start again by now. + // do this here - all processses should have reset buffers to start again by + // now. String msg = String.format("Starting PAMGuard go %d", nStarts); dumpBufferStatus(msg, false); } @@ -1280,28 +1326,32 @@ public class PamController implements PamControllerInterface, PamSettings { t1 = System.currentTimeMillis(); for (int iU = 0; iU < pamControlledUnits.size(); iU++) { pamControlledUnits.get(iU).pamToStart(); - // long t2 = System.currentTimeMillis(); - // System.out.printf("+++++++++++++++++++++++++++++++++++Time taken to call pamtoStart %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), t2-t1); - // t1 = t2; + // long t2 = System.currentTimeMillis(); + // System.out.printf("+++++++++++++++++++++++++++++++++++Time taken to call + // pamtoStart %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), + // t2-t1); + // t1 = t2; } for (int iU = 0; iU < pamControlledUnits.size(); iU++) { - for (int iP = 0; iP < pamControlledUnits.get(iU) - .getNumPamProcesses(); iP++) { + for (int iP = 0; iP < pamControlledUnits.get(iU).getNumPamProcesses(); iP++) { pamControlledUnits.get(iU).getPamProcess(iP).pamStart(); } - // long t2 = System.currentTimeMillis(); - // System.out.printf("==================================Time taken to call pamStart %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), t2-t1); - // t1 = t2; + // long t2 = System.currentTimeMillis(); + // System.out.printf("==================================Time taken to call + // pamStart %s was %d millis\n", pamControlledUnits.get(iU).getUnitName(), + // t2-t1); + // t1 = t2; } - // starting the DAQ may take a little while, so recheck and reset the + // starting the DAQ may take a little while, so recheck and reset the // start time. long startDelay = PamCalendar.getTimeInMillis() - PamCalendar.getSessionStartTime(); if (PamCalendar.isSoundFile() == false) { PamCalendar.setSessionStartTime(PamCalendar.getTimeInMillis()); } if (PamCalendar.isSoundFile() == false) { - System.out.printf("PAMGUARD Startup took %d milliseconds at time %s\n", startDelay, PamCalendar.formatDateTime(PamCalendar.getSessionStartTime())); + System.out.printf("PAMGUARD Startup took %d milliseconds at time %s\n", startDelay, + PamCalendar.formatDateTime(PamCalendar.getSessionStartTime())); } guiFrameManager.pamStarted(); @@ -1309,19 +1359,20 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Stopping PAMGUARD. Harder than you might think ! - * First a pamStop() is sent to all processes, then once - * that's done, a pamHasStopped is sent to all Controllers. - *

This is necessary when running in a multi-thread mode - * since some processes may still be receiving data and may still - * pass if on to other downstream processes, storage, etc. + * Stopping PAMGUARD. Harder than you might think ! First a pamStop() is sent to + * all processes, then once that's done, a pamHasStopped is sent to all + * Controllers. + *

+ * This is necessary when running in a multi-thread mode since some processes + * may still be receiving data and may still pass if on to other downstream + * processes, storage, etc. * */ @Override public void pamStop() { setPamStatus(PAM_STOPPING); - + // start the status check timer, so that we know when all the threads have // actually stopped // statusCheckThread = new Thread(new StatusTimer()); @@ -1330,28 +1381,28 @@ public class PamController implements PamControllerInterface, PamSettings { // tell all controlled units to stop for (int iU = 0; iU < pamControlledUnits.size(); iU++) { - for (int iP = 0; iP < pamControlledUnits.get(iU) - .getNumPamProcesses(); iP++) { + for (int iP = 0; iP < pamControlledUnits.get(iU).getNumPamProcesses(); iP++) { pamControlledUnits.get(iU).getPamProcess(iP).pamStop(); } } - + dumpBufferStatus("In stopping", false); /* - * now launch another thread to wait for everything to have stopped, but - * leave this function so that AWT is released and graphics can update, the - * wait thread will make a fresh call into AWT which will continue the stopping - * of everything. + * now launch another thread to wait for everything to have stopped, but leave + * this function so that AWT is released and graphics can update, the wait + * thread will make a fresh call into AWT which will continue the stopping of + * everything. */ detectorEndThread = new WaitDetectorThread(); Thread t = new Thread(detectorEndThread); t.start(); } - + /** - * Non AWT thread that sits and waits for detectors to actually finish their - * processing, leaving AWT unblocked. Then calls a function back into AWT to - * finish stopping, which will do stuff like closing binary files. + * Non AWT thread that sits and waits for detectors to actually finish their + * processing, leaving AWT unblocked. Then calls a function back into AWT to + * finish stopping, which will do stuff like closing binary files. + * * @author dg50 * */ @@ -1363,7 +1414,8 @@ public class PamController implements PamControllerInterface, PamSettings { while (checkRunStatus()) { long t2 = System.currentTimeMillis(); if (t2 - t1 > 5000) { - System.out.printf("Stopping, but stuck in loop for CheckRunStatus for %3.1fs\n", (double) (t2-t1)/1000.); + System.out.printf("Stopping, but stuck in loop for CheckRunStatus for %3.1fs\n", + (double) (t2 - t1) / 1000.); dumpBufferStatus("Stopping stuck in loop", false); break; // crap out anyway. } @@ -1373,66 +1425,67 @@ public class PamController implements PamControllerInterface, PamSettings { e.printStackTrace(); } } - // arrive here when all detectors have ended. + // arrive here when all detectors have ended. finishStopping(); } - + } - + /** - * Look in every data block, particularly threaded ones, and dump - * the buffer status. This will have to go via PamProcess so that - * additional information can be added from any processes that - * hold additional data in other internal buffers. - * @param message Message to print prior to dumping buffers for debug. - * @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still) + * Look in every data block, particularly threaded ones, and dump the buffer + * status. This will have to go via PamProcess so that additional information + * can be added from any processes that hold additional data in other internal + * buffers. + * + * @param message Message to print prior to dumping buffers for debug. + * @param sayEmpties dump info even if a buffer is empty (otherwise, only ones + * that have stuff still) */ public void dumpBufferStatus(String message, boolean sayEmpties) { - if (debugDumpBufferAtRestart == false) return; - + if (debugDumpBufferAtRestart == false) + return; + System.out.println("**** Dumping process buffer status: " + message); ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); for (PamControlledUnit aUnit : pamControlledUnits) { int numProcesses = aUnit.getNumPamProcesses(); - for (int i=0; i pamControlledUnits = pamConfiguration.getPamControlledUnits(); - + if (PamModel.getPamModel().isMultiThread()) { for (int iU = 0; iU < pamControlledUnits.size(); iU++) { pamControlledUnits.get(iU).flushDataBlockBuffers(2000); @@ -1451,7 +1504,7 @@ public class PamController implements PamControllerInterface, PamSettings { // e.printStackTrace(); // } // } - + // send out the pamHasStopped message // Debug.out.println("PamController letting everyone know PAMGuard has stopped."); for (int iU = 0; iU < pamControlledUnits.size(); iU++) { @@ -1461,10 +1514,10 @@ public class PamController implements PamControllerInterface, PamSettings { saveEndSettings(stopTime); setPamStatus(PAM_IDLE); - + guiFrameManager.pamEnded(); - - // no good having this here since it get's called at the end of every file. + + // no good having this here since it get's called at the end of every file. // if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) { //// can exit here, since we've auto started, can auto exit. // if (canClose()) { @@ -1473,10 +1526,10 @@ public class PamController implements PamControllerInterface, PamSettings { // } // } } - - public void batchProcessingComplete( ) { + + public void batchProcessingComplete() { if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) { - // can exit here, since we've auto started, can auto exit. + // can exit here, since we've auto started, can auto exit. if (canClose()) { pamClose(); shutDownPamguard(); @@ -1484,12 +1537,10 @@ public class PamController implements PamControllerInterface, PamSettings { } } - /** - * Status Timer class. Once started, will run in a thread - * and constantly check the buffers of all ThreadedObserver - * objects. Once all the buffers are empty, this will set - * the pam status to PAM_IDLE and let the thread die + * Status Timer class. Once started, will run in a thread and constantly check + * the buffers of all ThreadedObserver objects. Once all the buffers are empty, + * this will set the pam status to PAM_IDLE and let the thread die * * @author mo55 * @@ -1515,9 +1566,9 @@ public class PamController implements PamControllerInterface, PamSettings { // } /** - * Check the status of every threaded observer to see if it has emptied out - * it's buffer of events. If the buffer is empty, return true. If the thread - * is still processing, return false + * Check the status of every threaded observer to see if it has emptied out it's + * buffer of events. If the buffer is empty, return true. If the thread is still + * processing, return false * * @return true if ANY process is still running */ @@ -1556,15 +1607,15 @@ public class PamController implements PamControllerInterface, PamSettings { // Debug.out.println(" Are we finished? " + areWeFinished); // return areWeFinished; ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); - + boolean running = false; for (PamControlledUnit aUnit : pamControlledUnits) { int numProcesses = aUnit.getNumPamProcesses(); - for (int i=0; i findSettingsSources() { @@ -1646,6 +1696,7 @@ public class PamController implements PamControllerInterface, PamSettings { public boolean modelSettings(JFrame frame) { return pamModelInterface.modelSettings(frame); } + /* * (non-Javadoc) * @@ -1662,9 +1713,8 @@ public class PamController implements PamControllerInterface, PamSettings { /* * (non-Javadoc) * - * @see PamModel.PamModelInterface#GetFFTDataBlocks() Goes through all - * processes and makes an array list containing only data blocks of FFT - * data + * @see PamModel.PamModelInterface#GetFFTDataBlocks() Goes through all processes + * and makes an array list containing only data blocks of FFT data */ @Override public ArrayList getFFTDataBlocks() { @@ -1713,27 +1763,27 @@ public class PamController implements PamControllerInterface, PamSettings { @Override public ArrayList getDetectorEventDataBlocks() { - // return makeDataBlockList(PamguardMVC.DataType.DETEVENT); + // return makeDataBlockList(PamguardMVC.DataType.DETEVENT); return null; } @Override public PamDataBlock getDetectorEventDataBlock(int id) { - // return getDataBlock(PamguardMVC.DataType.DETEVENT, id); + // return getDataBlock(PamguardMVC.DataType.DETEVENT, id); return null; } @Override public PamDataBlock getDetectorEventDataBlock(String name) { - // return (PamDataBlock) getDataBlock(PamguardMVC.DataType.DETEVENT, name); + // return (PamDataBlock) getDataBlock(PamguardMVC.DataType.DETEVENT, name); return null; } @Override /** - * Note that in order to return a list of PamDataBlocks that contain objects implementing - * the AcousticDataUnit or PamDetection interfaces, the includeSubClasses boolean MUST be - * true. + * Note that in order to return a list of PamDataBlocks that contain objects + * implementing the AcousticDataUnit or PamDetection interfaces, the + * includeSubClasses boolean MUST be true. */ public ArrayList getDataBlocks(Class blockType, boolean includeSubClasses) { return pamConfiguration.getDataBlocks(blockType, includeSubClasses); @@ -1749,52 +1799,53 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Makes a list of data blocks for all processes in all controllers for a - * given DataType or for all DataTypes + * Makes a list of data blocks for all processes in all controllers for a given + * DataType or for all DataTypes * * @param blockType -- PamguardMVC.DataType.FFT, .RAW, etc., or null to - * get all extant blocks + * get all extant blocks * @return An ArrayList of data blocks */ - // private ArrayList makeDataBlockList(Enum blockType) { - // ArrayList blockList = new ArrayList(); - // PamProcess pP; + // private ArrayList makeDataBlockList(Enum blockType) { + // ArrayList blockList = new ArrayList(); + // PamProcess pP; // - // for (int iU = 0; iU < pamControlledUnits.size(); iU++) { - // for (int iP = 0; iP < pamControlledUnits.get(iU) - // .getNumPamProcesses(); iP++) { - // pP = pamControlledUnits.get(iU).getPamProcess(iP); - // for (int j = 0; j < pP.getNumOutputDataBlocks(); j++) { - // if (blockType == null - // || pP.getOutputDataBlock(j).getDataType() == blockType) { - // blockList.add(pP.getOutputDataBlock(j)); - // } - // } - // } - // } + // for (int iU = 0; iU < pamControlledUnits.size(); iU++) { + // for (int iP = 0; iP < pamControlledUnits.get(iU) + // .getNumPamProcesses(); iP++) { + // pP = pamControlledUnits.get(iU).getPamProcess(iP); + // for (int j = 0; j < pP.getNumOutputDataBlocks(); j++) { + // if (blockType == null + // || pP.getOutputDataBlock(j).getDataType() == blockType) { + // blockList.add(pP.getOutputDataBlock(j)); + // } + // } + // } + // } // private ArrayList makeDataBlockList(Class classType, boolean includSubClasses) { // return pamConfiguration.makeDataBlockList(classType, includSubClasses); // } - /** - * Find a block of a given type with the id number, or null if the number - * is out of range. + /** + * Find a block of a given type with the id number, or null if the number is out + * of range. * - * @param blockType - * @param id -- the block id number - * @return block, which you may want to cast to a subtype + * @param blockType + * @param id -- the block id number + * @return block, which you may want to cast to a subtype */ @Override public PamDataBlock getDataBlock(Class blockType, int id) { return pamConfiguration.getDataBlock(blockType, id); } - /** - * Find a block of a given type with the given name, or null if it - * doesn't exist. - * @param blockType -- RAW, FFT, DETECTOR, null, etc. - * @param name -- the block name - * @return block, which you may want to cast to a subtype + /** + * Find a block of a given type with the given name, or null if it doesn't + * exist. + * + * @param blockType -- RAW, FFT, DETECTOR, null, etc. + * @param name -- the block name + * @return block, which you may want to cast to a subtype */ @Override public PamDataBlock getDataBlock(Class blockType, String name) { @@ -1803,6 +1854,7 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Find a block with the given long name, or null if it doesn't exist. + * * @param longName the long name of the PamDataBlock * @return block */ @@ -1812,7 +1864,7 @@ public class PamController implements PamControllerInterface, PamSettings { /** * - * @return a list of offline data sources. + * @return a list of offline data sources. */ public ArrayList findOfflineDataStores() { ArrayList ods = new ArrayList(); @@ -1828,7 +1880,7 @@ public class PamController implements PamControllerInterface, PamSettings { } public OfflineDataStore findOfflineDataStore(Class sourceClass) { - ArrayList odss = findOfflineDataStores(); + ArrayList odss = findOfflineDataStores(); for (int i = 0; i < odss.size(); i++) { if (sourceClass.isAssignableFrom(odss.get(i).getClass())) { return odss.get(i); @@ -1838,55 +1890,57 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Updates the entire datamap. + * Updates the entire datamap. */ - public void updateDataMap(){ - System.out.println("updateDataMap:"); + public void updateDataMap() { + System.out.println("updateDataMap:"); - if (DBControlUnit.findDatabaseControl()==null) return; - - System.out.println("updateDataMap: 1"); + if (DBControlUnit.findDatabaseControl() == null) + return; - ArrayList datablocks=getDataBlocks() ; - - System.out.println("updateDataMap: 2"); + System.out.println("updateDataMap: 1"); + + ArrayList datablocks = getDataBlocks(); + + System.out.println("updateDataMap: 2"); DBControlUnit.findDatabaseControl().updateDataMap(datablocks); - - System.out.println("updateDataMap: 3"); + + System.out.println("updateDataMap: 3"); BinaryStore.findBinaryStoreControl().getDatagramManager().updateDatagrams(); - - System.out.println("updateDataMap: 4"); + + System.out.println("updateDataMap: 4"); notifyModelChanged(PamControllerInterface.EXTERNAL_DATA_IMPORTED); } - - + /** - * Create the datamap from the database + * Create the datamap from the database */ - public void createDataMap(){ - if (DBControlUnit.findDatabaseControl()==null) return; + public void createDataMap() { + if (DBControlUnit.findDatabaseControl() == null) + return; DBControlUnit.findDatabaseControl().createOfflineDataMap(getMainFrame()); BinaryStore.findBinaryStoreControl().createOfflineDataMap(getMainFrame()); } - - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see PamguardMVC.PamControllerInterface#NotifyModelChanged() */ @Override public void notifyModelChanged(int changeType) { - //System.out.println("PamController: notify model changed: " +changeType ); + // System.out.println("PamController: notify model changed: " +changeType ); if (changeType == CHANGED_MULTI_THREADING) { changedThreading(); } // no need for this, since array in now a controlled unit so it - // will get this notification anyway. - // ArrayManager.getArrayManager().notifyModelChanged(changeType); + // will get this notification anyway. + // ArrayManager.getArrayManager().notifyModelChanged(changeType); guiFrameManager.notifyModelChanged(changeType); @@ -1898,10 +1952,9 @@ public class PamController implements PamControllerInterface, PamSettings { PamSettingManager.getInstance().notifyModelChanged(changeType); - if (getRunMode() == PamController.RUN_PAMVIEW) { AbstractScrollManager.getScrollManager().notifyModelChanged(changeType); - if (changeType == CHANGED_OFFLINE_DATASTORE) { // called from both database and binary data mappers. + if (changeType == CHANGED_OFFLINE_DATASTORE) { // called from both database and binary data mappers. checkOfflineDataUIDs(); } } @@ -1915,30 +1968,31 @@ public class PamController implements PamControllerInterface, PamSettings { StorageOptions.getInstance().setBlockOptions(); } - // if we've just added a module, try to synchronise the UIDs with the the database and binary stores + // if we've just added a module, try to synchronise the UIDs with the the + // database and binary stores if (changeType == INITIALIZATION_COMPLETE || (initializationComplete && changeType == ADD_CONTROLLEDUNIT)) { uidManager.synchUIDs(true); } if (changeType == GLOBAL_TIME_UPDATE) { haveGlobalTimeUpdate = true; - } - else { + } else { globalTimeManager.notifyModelChanged(changeType); } - + if (moduleChange(changeType)) { clearSelectorsAndSymbols(); } - + if (changeType == DATA_LOAD_COMPLETE) { firstDataLoadComplete = true; } } - + /** - * Has there been a module change AFTER initial module loading. + * Has there been a module change AFTER initial module loading. + * * @param changeType * @return true if modules added or removed after initialisation complete */ @@ -1956,15 +2010,15 @@ public class PamController implements PamControllerInterface, PamSettings { } private void checkOfflineDataUIDs() { - ArrayList dataBlocks = getDataBlocks(); - for (PamDataBlock dataBlock:dataBlocks) { + ArrayList dataBlocks = getDataBlocks(); + for (PamDataBlock dataBlock : dataBlocks) { dataBlock.checkOfflineDataUIDs(); } } /** - * loop over all units and processes, telling them to - * re-subscribe to their principal data source + * loop over all units and processes, telling them to re-subscribe to their + * principal data source */ private void changedThreading() { PamProcess pamProcess; @@ -1985,18 +2039,17 @@ public class PamController implements PamControllerInterface, PamSettings { if (garbageTimer != null) { garbageTimer.stop(); } - } - else { + } else { if (garbageTimer == null) { - garbageTimer = new Timer(ms.gcInterval*1000, new ActionListener() { + garbageTimer = new Timer(ms.gcInterval * 1000, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { - // System.out.println("Additional Garbage collection called"); + // System.out.println("Additional Garbage collection called"); Runtime.getRuntime().gc(); } }); } - garbageTimer.setDelay(ms.gcInterval*1000); + garbageTimer.setDelay(ms.gcInterval * 1000); garbageTimer.start(); } } @@ -2010,7 +2063,7 @@ public class PamController implements PamControllerInterface, PamSettings { public long getSettingsVersion() { return 0; } - + @Override public String getUnitName() { return unitName; @@ -2032,7 +2085,8 @@ public class PamController implements PamControllerInterface, PamSettings { for (int i = 0; i < usedModules.size(); i++) { umi = usedModules.get(i); mi = PamModuleInfo.findModuleInfo(umi.className); - if (mi == null) continue; + if (mi == null) + continue; addModule(mi, umi.unitName); } return true; @@ -2043,7 +2097,8 @@ public class PamController implements PamControllerInterface, PamSettings { guiFrameManager.destroyModel(); - // also tell all PamControlledUnits since they may want to find their data source + // also tell all PamControlledUnits since they may want to find their data + // source // it that was created after they were - i.e. dependencies have got all muddled pamConfiguration.destroyModel(); @@ -2056,12 +2111,14 @@ public class PamController implements PamControllerInterface, PamSettings { destroyModel(); - setupPamguard(); + setupPamguard(); } + /** - * returns the status of Pamguard. The available status' will - * depend on the run mode. For instance, if run mode is RUN_NORMAL - * then status can be either PAM_IDLE or PAM_RUNNING. + * returns the status of Pamguard. The available status' will depend on the run + * mode. For instance, if run mode is RUN_NORMAL then status can be either + * PAM_IDLE or PAM_RUNNING. + * * @return Pamguard status */ public int getPamStatus() { @@ -2071,10 +2128,10 @@ public class PamController implements PamControllerInterface, PamSettings { public void setPamStatus(int pamStatus) { this.pamStatus = pamStatus; /* - * This only get's called once when set idle at viewer mode startup. + * This only get's called once when set idle at viewer mode startup. */ if (debugDumpBufferAtRestart) { - System.out.printf("******* PamController.setPamStatus to %d, real status is %d set in thread %s\n", + System.out.printf("******* PamController.setPamStatus to %d, real status is %d set in thread %s\n", pamStatus, getRealStatus(), Thread.currentThread().toString()); } if (getRunMode() != RUN_PAMVIEW) { @@ -2085,11 +2142,12 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * This was within the StatusCommand class, but useful to have it here since it's needed - * in more than one place. In viewer mode at startup there are a number of things going on - * in different threads, such as the creation of datamaps, and this can (hopefully) handle those bespoke - * goings on. - * @return program status for multithreaded statup tasks. + * This was within the StatusCommand class, but useful to have it here since + * it's needed in more than one place. In viewer mode at startup there are a + * number of things going on in different threads, such as the creation of + * datamaps, and this can (hopefully) handle those bespoke goings on. + * + * @return program status for multithreaded statup tasks. */ public int getRealStatus() { PamController pamController = PamController.getInstance(); @@ -2103,28 +2161,29 @@ public class PamController implements PamControllerInterface, PamSettings { int status = pamController.getPamStatus(); if (status == PamController.PAM_IDLE) { status = PamController.PAM_IDLE; - } - else { - ArrayList daqs = PamController.getInstance().findControlledUnits(AcquisitionControl.unitType); - if (daqs != null) for (int i = 0; i < daqs.size(); i++) { - try { - AcquisitionControl daq = (AcquisitionControl) daqs.get(i); - if (daq.isStalled()) { - status = PamController.PAM_STALLED; + } else { + ArrayList daqs = PamController.getInstance() + .findControlledUnits(AcquisitionControl.unitType); + if (daqs != null) + for (int i = 0; i < daqs.size(); i++) { + try { + AcquisitionControl daq = (AcquisitionControl) daqs.get(i); + if (daq.isStalled()) { + status = PamController.PAM_STALLED; + } + } catch (Exception e) { + e.printStackTrace(); } } - catch (Exception e) { - e.printStackTrace(); - } - } } WatchdogComms watchdogComms = PamController.getInstance().getWatchdogComms(); status = watchdogComms.getModifiedWatchdogState(status); /* - * This function is now being used in batch processing of offline data, where it may be necessary - * to get status information from many different modules, for example when executing offline tasks - * or just at startup while generating datamaps and datagrams. - * So go through all modules and get the highest state of any of them. + * This function is now being used in batch processing of offline data, where it + * may be necessary to get status information from many different modules, for + * example when executing offline tasks or just at startup while generating + * datamaps and datagrams. So go through all modules and get the highest state + * of any of them. */ if (getRunMode() == RUN_PAMVIEW) { if (firstDataLoadComplete == false) { @@ -2134,17 +2193,17 @@ public class PamController implements PamControllerInterface, PamSettings { for (PamControlledUnit aUnit : pamConfiguration.getPamControlledUnits()) { status = Math.max(status, aUnit.getOfflineState()); } - } - catch (Exception e) { - //just incase there is a concurrent modification at startup. + } catch (Exception e) { + // just incase there is a concurrent modification at startup. } } - + return status; } - + /** * show a warning when we're waiting for detectors to stop + * * @param pamStatus */ private void showStatusWarning(int pamStatus) { @@ -2156,17 +2215,17 @@ public class PamController implements PamControllerInterface, PamSettings { sayStatusWarning(null); } } - + /** - * Show a singleton status warning message. - * @param warningMessage Message - removes warning if set null. + * Show a singleton status warning message. + * + * @param warningMessage Message - removes warning if set null. */ private synchronized void sayStatusWarning(String warningMessage) { WarningSystem warningSystem = WarningSystem.getWarningSystem(); if (warningMessage == null) { warningSystem.removeWarning(statusWarning); - } - else { + } else { statusWarning.setWarningMessage(warningMessage); statusWarning.setWarnignLevel(1); warningSystem.addWarning(statusWarning); @@ -2175,12 +2234,10 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Gets the Pamguard running mode. This is set at startup (generally - * through slightly different versions of the main class). It will be - * one of - * RUN_NORMAL - * RUN_PAMVIEW - * RUN_MIXEDMODE + * Gets the Pamguard running mode. This is set at startup (generally through + * slightly different versions of the main class). It will be one of RUN_NORMAL + * RUN_PAMVIEW RUN_MIXEDMODE + * * @return Pamguards run mode */ public int getRunMode() { @@ -2200,17 +2257,19 @@ public class PamController implements PamControllerInterface, PamSettings { } } - // public void getNewViewTimes(Frame frame) { + // public void getNewViewTimes(Frame frame) { // - // PamViewParameters newParams = ViewTimesDialog.showDialog(null, pamViewParameters); - // if (newParams != null) { - // pamViewParameters = newParams.clone(); - // useNewViewTimes(); - // } - // } + // PamViewParameters newParams = ViewTimesDialog.showDialog(null, + // pamViewParameters); + // if (newParams != null) { + // pamViewParameters = newParams.clone(); + // useNewViewTimes(); + // } + // } /** - * Class to do some extra saving of view times. + * Class to do some extra saving of view times. + * * @author Douglas Gillespie * */ @@ -2239,141 +2298,139 @@ public class PamController implements PamControllerInterface, PamSettings { @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { pamViewParameters = ((PamViewParameters) pamControlledUnitSettings.getSettings()).clone(); - // useNewViewTimes(); + // useNewViewTimes(); return true; } } + // private long trueStart; + // private long trueEnd; + // + // public void useNewViewTimes() { + // AWTScheduler.getInstance().scheduleTask(new LoadViewerData()); + // } + // public class LoadViewerData extends SwingWorker + // { + // + // /* (non-Javadoc) + // * @see javax.swing.SwingWorker#doInBackground() + // */ + // @Override + // protected Integer doInBackground() throws Exception { + // loadViewData(); + // + // return null; + // } + // + // private void loadViewData() { + // setPamStatus(PAM_LOADINGDATA); + // PamCalendar.setViewTimes(pamViewParameters.viewStartTime, + // pamViewParameters.viewEndTime); + // // need to tell all datablocks to dump existing data and read in new. + // ArrayList pamDataBlocks = getDataBlocks(); + // PamDataBlock pamDataBlock; + // /* + // * also need to get the true max and min load times of the data + // * + // */ + // PamDataUnit pdu; + // trueStart = Long.MAX_VALUE; + // trueEnd = Long.MIN_VALUE; + // for (int i = 0; i < pamDataBlocks.size(); i++){ + // pamDataBlock = pamDataBlocks.get(i); + // pamDataBlock.clearAll(); + // pamDataBlock.loadViewData(this, pamViewParameters); + // pdu = pamDataBlock.getFirstUnit(); + // if (pdu != null) { + // trueStart = Math.min(trueStart, pdu.getTimeMilliseconds()); + // } + // pdu = pamDataBlock.getLastUnit(); + // if (pdu != null) { + // trueEnd = Math.max(trueEnd, pdu.getTimeMilliseconds()); + // } + // } + // } + // + // /* (non-Javadoc) + // * @see javax.swing.SwingWorker#done() + // */ + // @Override + // protected void done() { + // if (trueStart != Long.MAX_VALUE) { + // pamViewParameters.viewStartTime = trueStart; + // pamViewParameters.viewEndTime = trueEnd; + // PamCalendar.setViewTimes(trueStart, trueEnd); + //// viewerStatusBar.newShowTimes(); + // } + // newViewTime(); + // setPamStatus(PAM_IDLE); + // } + // + // /* (non-Javadoc) + // * @see javax.swing.SwingWorker#process(java.util.List) + // */ + // @Override + // protected void process(List vlp) { + // // TODO Auto-generated method stub + // for (int i = 0; i < vlp.size(); i++) { + //// displayProgress(vlp.get(i)); + // } + // } + // + // /** + // * Callback from SQLLogging in worker thread. + // * @param viewerLoadProgress + // */ + // public void sayProgress(ViewerLoadProgress viewerLoadProgress) { + // this.publish(viewerLoadProgress); + // } + // + // } - // private long trueStart; - // private long trueEnd; + // public void tellTrueLoadTime(long loadTime) { + // trueStart = Math.min(trueStart, loadTime); + // trueEnd = Math.max(trueEnd, loadTime); + // } // - // public void useNewViewTimes() { - // AWTScheduler.getInstance().scheduleTask(new LoadViewerData()); - // } + // public void newViewTime() { + // // view time has changed (probably from the slider) + // notifyModelChanged(PamControllerInterface.NEW_VIEW_TIME); + // } - // public class LoadViewerData extends SwingWorker { + // public void displayProgress(ViewerLoadProgress viewerLoadProgress) { + // if (viewerStatusBar == null) { + // return; + // } + //// if (viewerLoadProgress.getTableName() != null) { + // viewerStatusBar.setupLoadProgress(viewerLoadProgress.getTableName()); + //// } // - // /* (non-Javadoc) - // * @see javax.swing.SwingWorker#doInBackground() - // */ - // @Override - // protected Integer doInBackground() throws Exception { - // loadViewData(); - // - // return null; - // } - // - // private void loadViewData() { - // setPamStatus(PAM_LOADINGDATA); - // PamCalendar.setViewTimes(pamViewParameters.viewStartTime, pamViewParameters.viewEndTime); - // // need to tell all datablocks to dump existing data and read in new. - // ArrayList pamDataBlocks = getDataBlocks(); - // PamDataBlock pamDataBlock; - // /* - // * also need to get the true max and min load times of the data - // * - // */ - // PamDataUnit pdu; - // trueStart = Long.MAX_VALUE; - // trueEnd = Long.MIN_VALUE; - // for (int i = 0; i < pamDataBlocks.size(); i++){ - // pamDataBlock = pamDataBlocks.get(i); - // pamDataBlock.clearAll(); - // pamDataBlock.loadViewData(this, pamViewParameters); - // pdu = pamDataBlock.getFirstUnit(); - // if (pdu != null) { - // trueStart = Math.min(trueStart, pdu.getTimeMilliseconds()); - // } - // pdu = pamDataBlock.getLastUnit(); - // if (pdu != null) { - // trueEnd = Math.max(trueEnd, pdu.getTimeMilliseconds()); - // } - // } - // } - // - // /* (non-Javadoc) - // * @see javax.swing.SwingWorker#done() - // */ - // @Override - // protected void done() { - // if (trueStart != Long.MAX_VALUE) { - // pamViewParameters.viewStartTime = trueStart; - // pamViewParameters.viewEndTime = trueEnd; - // PamCalendar.setViewTimes(trueStart, trueEnd); - //// viewerStatusBar.newShowTimes(); - // } - // newViewTime(); - // setPamStatus(PAM_IDLE); - // } - // - // /* (non-Javadoc) - // * @see javax.swing.SwingWorker#process(java.util.List) - // */ - // @Override - // protected void process(List vlp) { - // // TODO Auto-generated method stub - // for (int i = 0; i < vlp.size(); i++) { - //// displayProgress(vlp.get(i)); - // } - // } - // - // /** - // * Callback from SQLLogging in worker thread. - // * @param viewerLoadProgress - // */ - // public void sayProgress(ViewerLoadProgress viewerLoadProgress) { - // this.publish(viewerLoadProgress); - // } - // - // } + // } - // public void tellTrueLoadTime(long loadTime) { - // trueStart = Math.min(trueStart, loadTime); - // trueEnd = Math.max(trueEnd, loadTime); - // } - // - // public void newViewTime() { - // // view time has changed (probably from the slider) - // notifyModelChanged(PamControllerInterface.NEW_VIEW_TIME); - // } - - //public void displayProgress(ViewerLoadProgress viewerLoadProgress) { - // if (viewerStatusBar == null) { - // return; - // } - //// if (viewerLoadProgress.getTableName() != null) { - // viewerStatusBar.setupLoadProgress(viewerLoadProgress.getTableName()); - //// } - // - //} - - // public void setupDBLoadProgress(String name) { + // public void setupDBLoadProgress(String name) { // - // if (viewerStatusBar != null) { - // viewerStatusBar.setupLoadProgress(name); - // } - // } - // public void setDBLoadProgress(long t) { + // if (viewerStatusBar != null) { + // viewerStatusBar.setupLoadProgress(name); + // } + // } + // public void setDBLoadProgress(long t) { // - // if (viewerStatusBar != null) { - // viewerStatusBar.setLoadProgress(t); - // } - // } + // if (viewerStatusBar != null) { + // viewerStatusBar.setLoadProgress(t); + // } + // } public boolean isInitializationComplete() { return initializationComplete; } - /** - * Called from PamDialog whenever the OK button is pressed. - * Don't do anything immediately to give the module that opened - * the dialog time to respond to it's closing (e.g. make the new - * settings from the dialog it's default). - * Use invokeLater to send out a message as soon as the awt que is clear. + * Called from PamDialog whenever the OK button is pressed. Don't do anything + * immediately to give the module that opened the dialog time to respond to it's + * closing (e.g. make the new settings from the dialog it's default). Use + * invokeLater to send out a message as soon as the awt que is clear. */ public void dialogOKButtonPressed() { @@ -2382,61 +2439,66 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Invoked later every time a dialog OK button is pressed. Sends - * out a message to all modules to say settings have changed. + * Invoked later every time a dialog OK button is pressed. Sends out a message + * to all modules to say settings have changed. + * * @author Doug * */ class DialogOKButtonPressed implements Runnable { @Override public void run() { - notifyModelChanged(PamControllerInterface.CHANGED_PROCESS_SETTINGS); + notifyModelChanged(PamControllerInterface.CHANGED_PROCESS_SETTINGS); } } /** - * Enables / Disables GUI for input. This is used when data are being loaded - * in viewer mode to prevetn impatient users from clicking on extra things while - * long background processes take place. + * Enables / Disables GUI for input. This is used when data are being loaded in + * viewer mode to prevetn impatient users from clicking on extra things while + * long background processes take place. *

- * Many of the processes loading data are run in the background in SwingWorker threads - * scheduled with the AWTScheduler so that they are able to update progress on teh screen - * @param enable enable or disable the GUI. + * Many of the processes loading data are run in the background in SwingWorker + * threads scheduled with the AWTScheduler so that they are able to update + * progress on teh screen + * + * @param enable enable or disable the GUI. */ public void enableGUIControl(boolean enable) { - // System.out.println("Enable GUI Control = " + enable); + // System.out.println("Enable GUI Control = " + enable); guiFrameManager.enableGUIControl(enable); } - // /** - // * Load viewer data into all the scrollers. - // */ - // public void loadViewerData() { - // // TODO Auto-generated method stub - // AbstractScrollManager scrollManager = AbstractScrollManager.getScrollManager(); - // scrollManager.reLoad(); - // - // } + // /** + // * Load viewer data into all the scrollers. + // */ + // public void loadViewerData() { + // // TODO Auto-generated method stub + // AbstractScrollManager scrollManager = + // AbstractScrollManager.getScrollManager(); + // scrollManager.reLoad(); + // + // } boolean loadingOldSettings = false; /** - * Flagged true if the manual stop button has been pressed. - * Used to override the watchdog status. + * Flagged true if the manual stop button has been pressed. Used to override the + * watchdog status. */ private boolean manualStop; - /** * Used when in viewer mode and planning batch processing with a modified * configuration, i.e. the command line has been supplied a normal viewer mode - * database and also a psfx file. The settings from the database will already have - * been loaded, this will load any modules that weren't there and will override all the - * settings in other modules with these ones (except some specials such as data storage locations) - * @param psfxFile Name of additional psfx file. + * database and also a psfx file. The settings from the database will already + * have been loaded, this will load any modules that weren't there and will + * override all the settings in other modules with these ones (except some + * specials such as data storage locations) + * + * @param psfxFile Name of additional psfx file. */ private boolean loadOtherSettings(String psfxName) { - + File psfxFile = new File(psfxName); if (psfxFile.exists() == false) { return false; @@ -2446,43 +2508,43 @@ public class PamController implements PamControllerInterface, PamSettings { if (settingsGroup == null) { return false; } - + BatchViewSettingsImport importer = new BatchViewSettingsImport(this, settingsGroup); importer.importSettings(); return true; } - + /** - * Called to load a specific set of PAMGUARD settings in - * viewer mode, which were previously loaded in from a - * database or binary store. + * Called to load a specific set of PAMGUARD settings in viewer mode, which were + * previously loaded in from a database or binary store. + * * @param settingsGroup settings information - * @param initialiseNow Immediately data are loaded, initialise which will load data from storages. + * @param initialiseNow Immediately data are loaded, initialise which will load + * data from storages. */ public void loadOldSettings(PamSettingsGroup settingsGroup) { loadOldSettings(settingsGroup, true); } - + /** - * Called to load a specific set of PAMGUARD settings in - * viewer mode, which were previously loaded in from a - * database or binary store. + * Called to load a specific set of PAMGUARD settings in viewer mode, which were + * previously loaded in from a database or binary store. + * * @param settingsGroup settings information - * @param initialiseNow Immediately data are loaded, initialise which will load data from storages. + * @param initialiseNow Immediately data are loaded, initialise which will load + * data from storages. */ public void loadOldSettings(PamSettingsGroup settingsGroup, boolean initialiseNow) { /** - * Three things to do: - * 1. consider removing modules which exist but are no longer needed - * 2. Add modules which aren't present but are needed - * 3. re-order modules - * 4. Load settings into modules - * 5. Ping round an initialisation complete message. + * Three things to do: 1. consider removing modules which exist but are no + * longer needed 2. Add modules which aren't present but are needed 3. re-order + * modules 4. Load settings into modules 5. Ping round an initialisation + * complete message. */ - // 1. get a list of current modules no longer needed. + // 1. get a list of current modules no longer needed. PamControlledUnit pcu; ArrayList toRemove = new ArrayList(); - for (int i = 0 ; i < getNumControlledUnits(); i++) { + for (int i = 0; i < getNumControlledUnits(); i++) { pcu = getControlledUnit(i); if (settingsGroup.findUnitSettings(pcu.getUnitType(), pcu.getUnitName()) == null) { toRemove.add(pcu); @@ -2501,8 +2563,7 @@ public class PamController implements PamControllerInterface, PamSettings { try { moduleClass = Class.forName(aModuleInfo.className); } catch (ClassNotFoundException e) { - System.out.println(String.format("The module with class %s is not available", - aModuleInfo.className)); + System.out.println(String.format("The module with class %s is not available", aModuleInfo.className)); continue; } if (findControlledUnit(moduleClass, aModuleInfo.unitName) == null) { @@ -2542,11 +2603,9 @@ public class PamController implements PamControllerInterface, PamSettings { } } /* - * try to get everything in the right order - * Needs a LUT which converts the current order - * into the required order, i.e. the first element - * of the LUT will be the current position of the - * unit we want to come first. + * try to get everything in the right order Needs a LUT which converts the + * current order into the required order, i.e. the first element of the LUT will + * be the current position of the unit we want to come first. */ int[] orderLUT = new int[getNumControlledUnits()]; PamControlledUnit aUnit; @@ -2562,8 +2621,7 @@ public class PamController implements PamControllerInterface, PamSettings { try { moduleClass = Class.forName(aModuleInfo.className); } catch (ClassNotFoundException e) { - System.out.println(String.format("The module with class %s is not available", - aModuleInfo.className)); + System.out.println(String.format("The module with class %s is not available", aModuleInfo.className)); continue; } aUnit = findControlledUnit(moduleClass, aModuleInfo.unitName); @@ -2575,10 +2633,10 @@ public class PamController implements PamControllerInterface, PamSettings { nFound++; } } - // reOrderModules(orderLUT); + // reOrderModules(orderLUT); /* - * Now try to give each module it's settings. + * Now try to give each module it's settings. */ initializationComplete = true; @@ -2590,38 +2648,40 @@ public class PamController implements PamControllerInterface, PamSettings { PamSettingManager.getInstance().loadSettingsGroup(settingsGroup, true); loadingOldSettings = false; - } /** - * Load settings for all modules in this group, then - * export as XML. + * Load settings for all modules in this group, then export as XML. + * * @param settingsGroup */ public void exportSettingsAsXML(PamSettingsGroup settingsGroup) { loadOldSettings(settingsGroup, false); this.exportGeneralXMLSettings((JFrame) getMainFrame(), settingsGroup.getSettingsTime()); - // exportDecimusXMLSettings(settingsGroup.getSettingsTime()); - //now do it with XML encoder to see what it's like ... - // String fName = String.format("XMLEncoded_%s.xml", PamCalendar.formatFileDateTime(settingsGroup.getSettingsTime())); - // File f = new File(fName); - // XMLEncoder encoder=null; - // try{ - // encoder=new XMLEncoder(new BufferedOutputStream(new FileOutputStream(fName))); - // }catch(FileNotFoundException fileNotFound){ - // System.out.println("ERROR: While Creating or Opening the File dvd.xml"); - // } - // Iterator it = settingsGroup.getUnitSettings().iterator(); - // while(it.hasNext()) { - // PamControlledUnitSettings set = it.next(); - // encoder.writeObject(set); - // } - // encoder.close(); + // exportDecimusXMLSettings(settingsGroup.getSettingsTime()); + // now do it with XML encoder to see what it's like ... + // String fName = String.format("XMLEncoded_%s.xml", + // PamCalendar.formatFileDateTime(settingsGroup.getSettingsTime())); + // File f = new File(fName); + // XMLEncoder encoder=null; + // try{ + // encoder=new XMLEncoder(new BufferedOutputStream(new + // FileOutputStream(fName))); + // }catch(FileNotFoundException fileNotFound){ + // System.out.println("ERROR: While Creating or Opening the File dvd.xml"); + // } + // Iterator it = + // settingsGroup.getUnitSettings().iterator(); + // while(it.hasNext()) { + // PamControlledUnitSettings set = it.next(); + // encoder.writeObject(set); + // } + // encoder.close(); } /** - * Get the name of the psf or database used to contain settings - * for this run. + * Get the name of the psf or database used to contain settings for this run. + * * @return name of psf or database */ public String getPSFName() { @@ -2644,11 +2704,11 @@ public class PamController implements PamControllerInterface, PamSettings { return dbc.getDatabaseName(); } return null; - } + } /** - * Get the name of the psf or database used to contain settings - * for this run. + * Get the name of the psf or database used to contain settings for this run. + * * @return name of psf or database */ public String getPSFNameWithPath() { @@ -2675,8 +2735,7 @@ public class PamController implements PamControllerInterface, PamSettings { public void toolBarStartButton(PamControlledUnit currentControlledUnit) { if (getRunMode() == RUN_PAMVIEW) { - } - else { + } else { pamStart(); } } @@ -2684,17 +2743,23 @@ public class PamController implements PamControllerInterface, PamSettings { public void toolBarStopButton(PamControlledUnit currentControlledUnit) { if (getRunMode() == RUN_PAMVIEW) { PlaybackControl.getViewerPlayback().stopViewerPlayback(); - } - else { + } else { pamStop(); manualStop = true; } } /** +<<<<<<< Updated upstream * Respond to storage options dialog. Selects whether data * are stored in binary, database or both * @param parentFrame +======= + * Respond to storage options dialog. Selects whethere data are stored in + * binary, database or both + * + * @param parentFrame +>>>>>>> Stashed changes */ public void storageOptions(JFrame parentFrame) { StorageOptions.getInstance().showDialog(parentFrame); @@ -2712,7 +2777,8 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Return a verbose level for debug output - * @return a verbose level for debug output. + * + * @return a verbose level for debug output. */ public int getVerboseLevel() { return 10; @@ -2721,7 +2787,7 @@ public class PamController implements PamControllerInterface, PamSettings { /** * Create a watchdog which will run independently and keep this thing going ! */ - public void createWatchDog() { + public void createWatchDog() { String runnableJar = null; try { runnableJar = Pamguard.class.getProtectionDomain().getCodeSource().getLocation().toString(); @@ -2739,8 +2805,8 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Returns the module that is currently being loaded. If null, it means we aren't - * loading anything right now + * Returns the module that is currently being loaded. If null, it means we + * aren't loading anything right now * * @return */ @@ -2752,11 +2818,12 @@ public class PamController implements PamControllerInterface, PamSettings { * Clears the variable holding info about the unit currently being loaded */ public void clearLoadedUnit() { - unitBeingLoaded=null; + unitBeingLoaded = null; } /** - * Get the Java compliance, i.e. what Java version is running. + * Get the Java compliance, i.e. what Java version is running. + * * @return integer value of java version e.g. Java 8 is return 1.8 */ public double getJCompliance() { @@ -2764,16 +2831,17 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Get the Java version. Only show the first decimal place (e.g. 12.0, not 12.0.1). If - * there is no decimal place (e.g. 13) then just show that. + * Get the Java version. Only show the first decimal place (e.g. 12.0, not + * 12.0.1). If there is no decimal place (e.g. 13) then just show that. * - * @return the Java version. + * @return the Java version. */ - static double getVersion () { + static double getVersion() { String version = System.getProperty("java.version"); /* - * strip down to the first non numeric character. and allow 0 or 1 decimal points. - * This should pull out any valid decimal number from the front of the string. + * strip down to the first non numeric character. and allow 0 or 1 decimal + * points. This should pull out any valid decimal number from the front of the + * string. */ int iLen = 0; int nDot = 0; @@ -2784,12 +2852,12 @@ public class PamController implements PamControllerInterface, PamSettings { if (ch == '.') { nDot++; } - } - else { + } else { break; - }; + } + ; } - + // int pos = version.indexOf('.'); // get the index of the first decimal // if (pos==-1) { // if there is no decimal place (e.g. Java 13) then just use the full string // pos=version.length(); @@ -2802,21 +2870,21 @@ public class PamController implements PamControllerInterface, PamSettings { // } double mainVersion = 0; try { - mainVersion = Double.parseDouble (version.substring (0, iLen)); + mainVersion = Double.parseDouble(version.substring(0, iLen)); + } catch (NumberFormatException e) { + } - catch (NumberFormatException e) { - - } - + return mainVersion; } /** * Notify the PamController that progress has been made in loading something. - * @param progress - holds progress info. + * + * @param progress - holds progress info. */ public void notifyTaskProgress(PamTaskUpdate progress) { - if (this.guiFrameManager!=null) { + if (this.guiFrameManager != null) { this.guiFrameManager.notifyLoadProgress(progress); } } @@ -2835,26 +2903,25 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Returns the current installation folder, or null if there was a problem determining - * the folder location. Note that the default file separator is included at the end - * of the string. + * Returns the current installation folder, or null if there was a problem + * determining the folder location. Note that the default file separator is + * included at the end of the string. + * * @return */ public String getInstallFolder() { return installFolder; } + /***** Convenience Functions *******/ - /*****Convenience Functions*******/ - - - /****Swing GUI*****/ + /**** Swing GUI *****/ /** - * Get the main frame if there is one. - * Can be used by dialogs when no one else has - * sorted out a frame reference to pass to them. - * @return reference to main GUI frame. + * Get the main frame if there is one. Can be used by dialogs when no one else + * has sorted out a frame reference to pass to them. + * + * @return reference to main GUI frame. */ public static Frame getMainFrame() { PamController c = getInstance(); @@ -2862,31 +2929,29 @@ public class PamController implements PamControllerInterface, PamSettings { return null; } if (c.guiFrameManager instanceof GuiFrameManager) { - GuiFrameManager guiFrameManager = (GuiFrameManager) c.guiFrameManager; + GuiFrameManager guiFrameManager = (GuiFrameManager) c.guiFrameManager; if (guiFrameManager.getNumFrames() <= 0) { return null; } return guiFrameManager.getFrame(0); } - return null; + return null; } @Override public GuiFrameManager getGuiFrameManager() { if (guiFrameManager instanceof GuiFrameManager) { - return (GuiFrameManager) guiFrameManager; - } - else { + return (GuiFrameManager) guiFrameManager; + } else { return null; } } - public void sortFrameTitles(){ + public void sortFrameTitles() { getGuiFrameManager().sortFrameTitles(); } - - /****FX Gui*****/ + /**** FX Gui *****/ @Deprecated public PamGuiManagerFX getGuiManagerFX() { return (PamGuiManagerFX) this.guiFrameManager; @@ -2897,11 +2962,12 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Set the install folder. + * Set the install folder. + * * @param installFolder */ public void setInstallFolder(String installFolder) { - this.installFolder=installFolder; + this.installFolder = installFolder; } @@ -2944,7 +3010,8 @@ public class PamController implements PamControllerInterface, PamSettings { } /** - * Gt the main PAMGuard configuration (list of connected modules). + * Gt the main PAMGuard configuration (list of connected modules). + * * @return the pamConfiguration */ public PamConfiguration getPamConfiguration() { diff --git a/src/PamController/PamguardVersionInfo.java b/src/PamController/PamguardVersionInfo.java index d1cee5f8..b989d008 100644 --- a/src/PamController/PamguardVersionInfo.java +++ b/src/PamController/PamguardVersionInfo.java @@ -31,12 +31,12 @@ 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.11e"; + static public final String version = "2.02.11f"; /** * Release date */ - static public final String date = "19 June 2024"; + static public final String date = "24 June 2024"; // /** // * Release type - Beta or Core diff --git a/src/PamModel/PamModel.java b/src/PamModel/PamModel.java index b0776c48..e97b315e 100644 --- a/src/PamModel/PamModel.java +++ b/src/PamModel/PamModel.java @@ -472,7 +472,7 @@ final public class PamModel implements PamSettings { mi.setModulesMenuGroup(utilitiesGroup); mi.setMaxNumber(1); //mi.addGUICompatabilityFlag(PamGUIManager.FX); //has FX enabled GUI. -// mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(SMRUEnable.isEnable() == false); } /* diff --git a/src/dataPlotsFX/rawDataPlotFX/RawSoundPlotDataFX.java b/src/dataPlotsFX/rawDataPlotFX/RawSoundPlotDataFX.java index 04260b9b..e20acecf 100644 --- a/src/dataPlotsFX/rawDataPlotFX/RawSoundPlotDataFX.java +++ b/src/dataPlotsFX/rawDataPlotFX/RawSoundPlotDataFX.java @@ -382,7 +382,7 @@ public class RawSoundPlotDataFX { if (soundStore.currentRawDataMillis==0){ if (++timeErrors < 10) { - System.err.println("RawSoundPlotData: Raw sound data has no associated millisecond time: "+ soundStore.currentRawDataMillis); +// System.err.println("RawSoundPlotData: Raw sound data has no associated millisecond time: "+ soundStore.currentRawDataMillis); } return; } diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_animalspot_1.png b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_animalspot_1.png index 8aa822e3..a406874c 100644 Binary files a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_animalspot_1.png and b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_animalspot_1.png differ diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_1.png b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_1.png index c70cbffb..96145e72 100644 Binary files a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_1.png and b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_1.png differ diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_2.png b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_2.png index 70abc303..c70a2d4d 100644 Binary files a/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_2.png and b/src/help/classifiers/rawDeepLearningHelp/docs/images/advanced_settings_generic_2.png differ diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/images/deep_leanring_module_help.png b/src/help/classifiers/rawDeepLearningHelp/docs/images/deep_leanring_module_help.png index 250486bc..79fff4d3 100644 Binary files a/src/help/classifiers/rawDeepLearningHelp/docs/images/deep_leanring_module_help.png and b/src/help/classifiers/rawDeepLearningHelp/docs/images/deep_leanring_module_help.png differ diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/images/default_settings_humpback_1.png b/src/help/classifiers/rawDeepLearningHelp/docs/images/default_settings_humpback_1.png new file mode 100644 index 00000000..eaf71e68 Binary files /dev/null and b/src/help/classifiers/rawDeepLearningHelp/docs/images/default_settings_humpback_1.png differ diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Bugs.html b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Bugs.html index 2139a1b1..3ca4a041 100644 --- a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Bugs.html +++ b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Bugs.html @@ -9,8 +9,14 @@

PAMGuard's Deep Learning Module

-

Common Bugs and Mistakes

-
+ +

Common bugs and mistakes

+

The first time you use the module and/or load a different type + of model e.g. a tensorflow or pytorch model, you must be connected to + the internet.

+

You must install the correct version of CUDA for hardware + acceleration using an Nvidea GPU. See the currently supported CUDA + versions on the Pytorch and Tensorflow websites.

You should always have deep learning models in their own folder. Do not have any additional jar files or other programming related things (like .dll files) in the same or sub folders. This has been diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_CreateAndConfig.html b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_CreateAndConfig.html index d9394ad4..47d78312 100644 --- a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_CreateAndConfig.html +++ b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_CreateAndConfig.html @@ -7,20 +7,18 @@ -

PAMGuard Deep - Learning Module

-

Creation and Configuration

-
-

Creating an instance - of the module

+

PAMGuard Deep Learning + Module

+ +

Creating an instance + of the module

The module can be added from the File> Add modules > Classifier > Raw deep learning classifier menu or by right clicking in the data model. More than one instance of the module can be added if multiple deep learning models are required.

-
-

Module settings

+

Module settings

The module settings are opened by selecting the Settings > Raw deep learning classifier menu. The main settings pane is shown @@ -28,18 +26,18 @@ and Deep Learning Model

- +

The main settings pane for the deep learning module with descriptions

-

Raw Sound Data

The deep learning module accepts any raw data source i.e., any - data source that contains raw waveform data.

+ data source that contains raw waveform data e.g. clicks, clips and + Ishmael detections. Note that the module accepts whislte and moan + detections but only if a delphinID classifier has been loaded.

If the data is continuous, e.g. from the Sound Acquisition module then deep learning detections are saved to PAMGuard's data management system if they pass a user defined prediction threshold. @@ -57,7 +55,6 @@ processes. So, for example if channels 0 and 2 are in a group, then the raw waveform data from both channel 0 and 2 will be saved and can be used in downstream processes, e.g., for localisation.

-

Segmentation

The segmentation section defines how the raw data is segmented. Some @@ -72,7 +69,6 @@ re-merge is the maximum number of segments that can form a single data unit before a new data unit is automatically created.

-

Deep Learning Model

The deep learning model section is used to select the deep learning model. The drop down menu is used to select the framework the @@ -92,14 +88,12 @@

Once the model has loaded there some unique options depending on the currently selected framework.

-

Generic Model

A generic model must be set up via the Advanced menu button.

- +

@@ -124,8 +118,7 @@ including the shape of the input data e.g. a 100x50 image.

- +

@@ -146,16 +139,15 @@ transforms and input and output data whenever settings up a new PAMGuard data model and allow easier sharing of classifiers amongst researchers.

-
-

AnimalSpot and Ketos models

+

Koogu, + Ketos, AnimalSpot, PAMGuard zip and delphinID models

- If using an AnimalSpot or Ketos model then all transforms are - automatically set up. The transforms can be viewed and altered via the - Advanced menu button but in the majority of cases these settings - should not be used. It is advisable to select "Use default - segment length" to change the Window length to the - default for the selected model. Note that this is often necessary for - Ketos models but usually not a requirement for AnimalSpot models. + If using a deep learning model from a supported framework then all + transforms are automatically set up. The transforms can be viewed and + altered via the Advanced menu button but in the majority of cases + these settings should not be used. For some models, it is advisable to + select "Use default segment length" to change the Window + length to the default for the selected model.

- An AnimalSpot or Ketos model will automatically create a list - of transforms with the appropriate settings. These is no need to use - the advanced pane but it is there in case users wish to change - transform settings for some reason + An AnimalSpot, Ketos or other supported deep learning model + will automatically create a list of transforms with the appropriate + settings. These is no need to use the advanced pane but it is there + in case users wish to change transform settings for some reason

+

Default Models

+

Default models are selectable from the menu button in the Deep + Learning Pane. Default models are deep learning classifiers which are + open source, known to be effective and have have been published in + open access academic litrature; they are downloaded directly from a + GitHub repository and then all associated settings are automtically + applied. The default model selection pane also contains hyperlinks to + the papers descirbing each model which will take users directly to the + relvent website.

+ +

+ +

+ +

+ Default models can be downloaded. Default models are models + which are published, open and have been known to work well amongst + the bioacoustics community. More will be added to PAMGaurd over time. + If you you would like your model to become a defualt model then drop + PAMGuard support an email. +

+


- - + +


diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Results.html b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Results.html index c02e5cd2..a84d6eb7 100644 --- a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Results.html +++ b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Results.html @@ -9,12 +9,12 @@

PAMGuard's Deep Learning Module

+ +

Viewing and exporting results

-

Output from the deep learning module can be viewed in PAMGuard viewer mode, or extracted from binary files using MATLAB or R.

-

PAMGuard viewer mode

Detections form continuous raw data are shown in the datagram in the same way as all data streams in PAMGuard.

@@ -32,7 +32,7 @@ manual analyst can quickly navigate to detections with high prediction values for a certain class. Hovering over or right clicking on a data unit in the time display and selecting the information button, will - show the data unit's metadata, including the prediction values for all + show the data unit’s metadata, including the prediction values for all output classes from the deep learning model.

@@ -50,7 +50,6 @@ deep learning prediction values. The spectrogram will also show deep learning detections as translucent blue boxes (these must be selected in the right click menu).

-

MATLAB

The easiest way to export to MATLAB is to select the desired units in the time base display, right click and select the MATLAB @@ -96,7 +95,7 @@ predicitons = dldetections(1).annotations.dlcla waveform data in each structure;

 		
-% plot all the spectrograms.
+			% plot all the spectrograms.
 clf
 tiledlayout(5,5)
 for i=5,5Right whale detections from a deep learning model imported
 			and then plotted in MATLAB
 	

-

R

In the same way as MATLAB export, the PAMGuard time base display and export selected data units directly to an R struct which can be @@ -165,13 +163,17 @@ tiledlayout(5,5here.

+


- - + +


diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Running.html b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Running.html index 5181a525..9d9d2cfe 100644 --- a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Running.html +++ b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_Running.html @@ -10,12 +10,10 @@

PAMGuard's Deep Learning Module

Running

-

Real time

In real time, the deep learning model runs automatically when processing starts. A warning will appear if there are issues with the model and/or it cannot cope with real time speeds.

-

Viewer Mode

The deep learning module can be re-run on detector data (e.g. @@ -26,13 +24,18 @@ Detections without a deep learning annotation will have one added and detections with an existing annotation will have it overwritten.

+


- - + +


diff --git a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_overview.html b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_overview.html index d1b350d9..668b1a52 100644 --- a/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_overview.html +++ b/src/help/classifiers/rawDeepLearningHelp/docs/rawDeepLearning_overview.html @@ -7,10 +7,11 @@ -

PAMGuard Deep - Learning Module

+

PAMGuard's deep + learning module

+

Note: this module requires an internet connection upon first use + to download correct libraries.

Overview

-

PAMGuard's deep learning module allows users to deploy a large variety of deep learning models natively in PAMGuard. It is core module, fully integrated into PAMGuard's display and data @@ -19,9 +20,7 @@ signal and can integrate into multiple types of acoustic analysis workflows, for example post analysis of recorder data or used as part of real time localisation workflow.

- -
-

How it works

+

How it works

The deep learning module accepts raw data from different types of data sources, e.g. from the Sound Acquisition module, clicks and clips. It segments data into equal sized chunks with a specified @@ -32,8 +31,7 @@ learning model, then can be automatically set up by PAMGuard. Currently there are three implemented frameworks

- +

@@ -44,7 +42,6 @@ the model are saved and can be viewed in real time (e.g. mitigation) or in post processing (e.g. data from SoundTraps).

-

Generic Model

A generic model allows a user to load any model compatible with the -

AnimalSpot

ANIMAL-SPOT is a deep learning based framework which was initially designed for killer + href="(https://github.com/ChristianBergler/ORCA-SPOT">killer whale sound detection) in noise heavy underwater recordings (see Bergler et al. (2019)). It has now been expanded to a be species independent @@ -68,21 +64,43 @@ AnimalSpot models will automatically set up their own data transforms and output classes.

-

Ketos

Ketos is an acoustic deep learning framework based on Tensorflow and developed by MERIDIAN. It has excellent resources and tutorials and Python libraries can be installed easily - via pip. Imported Ketos model will automatically set up their own data + via pip. Imported Ketos (.ktpb) models will automatically set up their + own data transforms and output classes. +

+

Koogu

+

+ Koogu is + a Python package which allows users to train a deep learning model. + Koogu helps users by integrating with some frequency used annotation + programs and provides tools to train and test classifiers. Imported + Koogu models (.kgu) will automatically set up their own data transforms and output classes.

+

PAMGuardZip

+

+ PAMGuard zip models consist of a deep learning model (either a + Tensorflow saved_model.pb or PyTorch *.py model) alongside a + PAMGuard metdata file (.pdtf*) within a zip archive. The metadata + file contains all the information needed for PAMGaurd to set up the + model. PAMGuard will import the zip file, decompress it and search for + the relevent deep learning model and metadata file then set up all + settings accordingly. This framework allows users to easily share + pre-tested PAMGuard compatible models. +

+


- +


diff --git a/src/loggerForms/controls/CounterControl.java b/src/loggerForms/controls/CounterControl.java index 120256ee..b6edf687 100644 --- a/src/loggerForms/controls/CounterControl.java +++ b/src/loggerForms/controls/CounterControl.java @@ -21,6 +21,7 @@ public class CounterControl extends SimpleControl { Character suffix; + public enum CounterSuffix {NOSUFFIX, CHARSUFFIX}; public CounterControl(ControlDescription controlDescription, LoggerForm loggerForm) { @@ -36,25 +37,19 @@ public class CounterControl extends SimpleControl { } - - - - - - private String calculateCounter() { int num = FormCounterManagement.getInstance().getCounterNumber(this,controlDescription.getFormDescription().getDBTABLENAME()); - String numSt = Integer.toString(num); - int nZeros = 3-numSt.length(); - - String tSt = ""; - for (int i=0;i