@@ -82,6 +82,8 @@ public class CalamariReportsEngine implements Serializable {
82
82
83
83
private boolean doWriteReportFiles ;
84
84
85
+ private String folderForScansToZip ;
86
+
85
87
/**
86
88
* @param squidProject
87
89
*/
@@ -109,6 +111,7 @@ public CalamariReportsEngine(SquidProject squidProject) {
109
111
this .unknownMeanRatios_PerSpot = new StringBuilder ();
110
112
111
113
this .doWriteReportFiles = true ;
114
+ folderForScansToZip = "SCANStoZIP" + File .separator ;
112
115
}
113
116
114
117
public static String getFormattedDate (long milliseconds ) {
@@ -195,15 +198,15 @@ public File produceReports(
195
198
+ File .separator + sdfTime .format (new Date ())
196
199
+ reportParameterValues
197
200
+ File .separator ;
198
- File reportsFolder = new File (folderToWriteCalamariReportsPath );
199
- if (! reportsFolder .mkdirs ()) {
200
- throw new IOException ( "Failed to delete reports folder '" + folderToWriteCalamariReportsPath + "'" ) ;
201
- }
201
+ File reportsFolder = new File (sdfTime . format ( new Date ()) + reportParameterValues );
202
+ reportsFolder .mkdirs ();
203
+ folderForScansToZip = reportsFolder . getAbsolutePath () + File . separator ;
204
+
202
205
retVal = reportsFolder ;
203
206
204
207
// get docs for folder
205
208
Path resourcePath = Squid .SQUID_RESOURCE_EXTRACTOR .extractResourceAsPath ("/org/cirdles/squid/docs/SquidPerScanReportsDocumentation.pdf" );
206
- Path newFile = Paths .get (folderToWriteCalamariReportsPath , "SquidPerScanReportsDocumentation.pdf" );
209
+ Path newFile = Paths .get (folderForScansToZip , "SquidPerScanReportsDocumentation.pdf" );
207
210
try (OutputStream os = new FileOutputStream (newFile .toFile ())) {
208
211
209
212
Files .copy (resourcePath , os );
@@ -633,7 +636,7 @@ private void prepSpeciesReportFiles(ShrimpFraction shrimpFraction) throws IOExce
633
636
int countOfIntegrations = shrimpFraction .getPeakMeasurementsCount ();
634
637
635
638
if (doWriteReportFiles ) {
636
- ionIntegrations_PerScan = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "Check_01_IonIntegrations_PerScan.csv" );
639
+ ionIntegrations_PerScan = new File (folderForScansToZip + reportNamePrefix + "Check_01_IonIntegrations_PerScan.csv" );
637
640
}
638
641
StringBuilder header = new StringBuilder ();
639
642
header .append ("Title, Date, Scan, Type, Dead_time_ns" );
@@ -651,7 +654,10 @@ private void prepSpeciesReportFiles(ShrimpFraction shrimpFraction) throws IOExce
651
654
}
652
655
653
656
if (doWriteReportFiles ) {
654
- sBMIntegrations_PerScan = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "Check_02_SBMIntegrations_PerScan.csv" );
657
+ // File scansToZip = new File("SCANStoZIP");
658
+ // scansToZip.mkdirs();
659
+ // folderForScansToZip = scansToZip.getAbsolutePath() + File.separator;
660
+ sBMIntegrations_PerScan = new File (folderForScansToZip + reportNamePrefix + "Check_02_SBMIntegrations_PerScan.csv" );
655
661
}
656
662
657
663
header = new StringBuilder ();
@@ -670,7 +676,7 @@ private void prepSpeciesReportFiles(ShrimpFraction shrimpFraction) throws IOExce
670
676
}
671
677
672
678
if (doWriteReportFiles ) {
673
- totalCounts_IonsAndSBM_PerScan = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "SQUID_01_TotalCounts_IonsAndSBM_PerScan.csv" );
679
+ totalCounts_IonsAndSBM_PerScan = new File (folderForScansToZip + reportNamePrefix + "SQUID_01_TotalCounts_IonsAndSBM_PerScan.csv" );
674
680
}
675
681
header = new StringBuilder ();
676
682
header .append ("Title, Date, Scan, Type" );
@@ -689,7 +695,7 @@ private void prepSpeciesReportFiles(ShrimpFraction shrimpFraction) throws IOExce
689
695
}
690
696
691
697
if (doWriteReportFiles ) {
692
- nuclideCPS_PerSpot = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "SQUID_02_NuclideCPS_PerSpot.csv" );
698
+ nuclideCPS_PerSpot = new File (folderForScansToZip + reportNamePrefix + "SQUID_02_NuclideCPS_PerSpot.csv" );
693
699
}
694
700
header = new StringBuilder ();
695
701
header .append ("Title, Date, Type" );
@@ -710,7 +716,7 @@ private void prepSpeciesReportFiles(ShrimpFraction shrimpFraction) throws IOExce
710
716
private void prepRatiosReportFiles (ShrimpFraction shrimpFractionUnknown , ShrimpFraction shrimpFractionRefMat ) throws IOException {
711
717
// report Squid_03 headers
712
718
if (doWriteReportFiles ) {
713
- withinSpotRatios_PerScanMinus1 = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "SQUID_03_WithinSpotRatios_PerScanMinus1.csv" );
719
+ withinSpotRatios_PerScanMinus1 = new File (folderForScansToZip + reportNamePrefix + "SQUID_03_WithinSpotRatios_PerScanMinus1.csv" );
714
720
}
715
721
716
722
unknownHeaderWithinSpotRatios_PerScanMinus1 = new StringBuilder ();
@@ -810,7 +816,7 @@ private void prepRatiosReportFiles(ShrimpFraction shrimpFractionUnknown, ShrimpF
810
816
811
817
// report squid_04 headers *********************************************
812
818
if (doWriteReportFiles ) {
813
- meanRatios_PerSpot = new File (folderToWriteCalamariReportsPath + reportNamePrefix + "SQUID_04_MeanRatios_PerSpot.csv" );
819
+ meanRatios_PerSpot = new File (folderForScansToZip + reportNamePrefix + "SQUID_04_MeanRatios_PerSpot.csv" );
814
820
}
815
821
816
822
unknownHeaderMeanRatios_PerSpot = new StringBuilder ();
0 commit comments