Update to the same format as PAMBinaries for exporting to R

This commit is contained in:
Jamie Mac 2024-08-23 15:04:32 +01:00
parent a05c77b2fd
commit 4f233dd43e
5 changed files with 36 additions and 12 deletions

27
pom.xml
View File

@ -23,6 +23,8 @@
<jaxb.runtime.version>2.4.0-b180830.0438</jaxb.runtime.version>
<jaxb.api.version>2.4.0-b180830.0359</jaxb.api.version>
<jaxb.xjc.version>2.4.0-b180830.0438</jaxb.xjc.version>
<mockito.version>1.10.19</mockito.version>
<powermock.version>1.6.6</powermock.version>
</properties>
<build>
@ -888,7 +890,7 @@
<dependency>
<groupId>tethys.org</groupId>
<artifactId>nilus</artifactId>
<version>3.0</version>
<version>3.1</version>
</dependency>
<dependency>
@ -972,5 +974,28 @@
</dependency>
<!-- Four dependencies from xbee library that are needed for Genus module. -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -33,7 +33,10 @@ public abstract class RDataUnitExport<T extends PamDataUnit<?, ?>> {
rData.add("UID", dataUnit.getUID());
rData.add("startSample", dataUnit.getStartSample());
rData.add("sampleDuration", dataUnit.getSampleDuration());
rData.add("freqLimits", new DoubleArrayVector(dataUnit.getBasicData().getFrequency()));
// rData.add("freqLimits", new DoubleArrayVector(dataUnit.getBasicData().getFrequency()));
rData.add("minFreq", dataUnit.getBasicData().getFrequency()[0]);
rData.add("maxFreq", dataUnit.getBasicData().getFrequency()[1]);
rData.add("amplitude", dataUnit.getBasicData().getCalculatedAmlitudeDB());
//there may be no delay info
if (dataUnit.getBasicData().getTimeDelaysSeconds()!=null && dataUnit.getBasicData().getTimeDelaysSeconds().length>=1){

View File

@ -187,7 +187,9 @@ public class RExportManager implements PamDataUnitExporter {
//check whether the same.
if (rDataExport.get(i).getUnitClass().isAssignableFrom(dataUnits.get(j).getClass()) && !alreadyStruct[j]) {
dataList=rDataExport.get(i).detectionToStruct(dataUnits.get(j), n);
dataListArray.add((rDataExport.get(i).getName() + "_" + dataUnits.get(j).getUID()), dataList);
//dataListArray.add((rDataExport.get(i).getName() + "_" + dataUnits.get(j).getUID()), dataList);
// format used in PAMBinaries
dataListArray.add(String.valueOf(dataUnits.get(j).getUID()), dataList);
sampleRate = dataUnits.get(j).getParentDataBlock().getSampleRate();
n++;

View File

@ -4,9 +4,6 @@ import org.renjin.sexp.AttributeMap;
import org.renjin.sexp.IntArrayVector;
import org.renjin.sexp.ListVector;
import export.MLExport.MLWhistleMoanExport;
import us.hebi.matlab.mat.format.Mat5;
import us.hebi.matlab.mat.types.Struct;
import org.renjin.sexp.ListVector.NamedBuilder;
import PamUtils.PamArrayUtils;
@ -37,7 +34,7 @@ public class RWhistleExport extends RDataUnitExport<ConnectedRegionDataUnit> {
rData.add("nSlices", dataUnit.getConnectedRegion().getNumSlices());
rData.add("sliceData", peakDatas);
rData.add("contour", contours);
rData.add("contourWidth", contourWidth);
rData.add("contWidth", contourWidth);
rData.add("meanWidth", PamArrayUtils.mean(contourData[0]));
@ -84,8 +81,6 @@ public class RWhistleExport extends RDataUnitExport<ConnectedRegionDataUnit> {
ListVector.NamedBuilder peakDatas = new ListVector.NamedBuilder(); ;
Struct mlStructure= Mat5.newStruct(dataUnit.getConnectedRegion().getSliceData().size(), 1);
//the start sample.
int sliceNumber;
int nPeaks;
@ -127,7 +122,7 @@ public class RWhistleExport extends RDataUnitExport<ConnectedRegionDataUnit> {
rData.add("nPeaks", nPeaks);
rData.add("peakData", peakDataR);
peakDatas.add(String.valueOf(sliceNumber), rData);
peakDatas.add("[["+String.valueOf(i)+"]]", rData);
}

View File

@ -6,7 +6,6 @@ import PamguardMVC.PamDataUnit;
import PamguardMVC.dataSelector.DataSelectParams;
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.dlClassification.DLDetection;
import rawDeepLearningClassifier.dlClassification.PredictionResult;
import rawDeepLearningClassifier.logging.DLAnnotation;