changeset 28:afe6d8bac0c0 draft

Uploaded
author greg
date Mon, 12 Mar 2018 09:15:16 -0400 (2018-03-12)
parents 452e0e189e84
children dd0f1b7528aa
files insect_phenology_model.R insect_phenology_model.xml test-data/output1.csv test-data/output2.csv test-data/output3.csv test-data/output4.csv test-data/plot.pdf test-data/pop_by_generation.pdf
diffstat 8 files changed, 87 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/insect_phenology_model.R	Fri Mar 09 13:41:38 2018 -0500
+++ b/insect_phenology_model.R	Mon Mar 12 09:15:16 2018 -0400
@@ -1057,14 +1057,7 @@
 if (process_nymphs) {
     # Calculate nymph populations for selected life stage.
     for (life_stage_nymph in life_stages_nymph) {
-        if (life_stage_nymph=="Total") {
-            # Mean value for all nymphs.
-            total_nymphs = apply((YoungNymphs.replications+OldNymphs.replications), 1, mean);
-            temperature_data_frame = append_vector(temperature_data_frame, total_nymphs, "TOTALNYMPH");
-            # Standard error for all nymphs.
-            total_nymphs.std_error = apply((YoungNymphs.replications+OldNymphs.replications) / sqrt(opt$replications), 1, sd);
-            temperature_data_frame = append_vector(temperature_data_frame, total_nymphs.std_error, "TOTALNYMPHSE");
-        } else if (life_stage_nymph=="Young") {
+        if (life_stage_nymph=="Young") {
             # Mean value for young nymphs.
             young_nymphs = apply(YoungNymphs.replications, 1, mean);
             temperature_data_frame = append_vector(temperature_data_frame, young_nymphs, "YOUNGNYMPH");
@@ -1078,20 +1071,20 @@
             # Standard error for old nymphs.
             old_nymphs.std_error = apply(OldNymphs.replications / sqrt(opt$replications), 1, sd);
             temperature_data_frame = append_vector(temperature_data_frame, old_nymphs.std_error, "OLDNYMPHSE");
+        } else if (life_stage_nymph=="Total") {
+            # Mean value for all nymphs.
+            total_nymphs = apply((YoungNymphs.replications+OldNymphs.replications), 1, mean);
+            temperature_data_frame = append_vector(temperature_data_frame, total_nymphs, "TOTALNYMPH");
+            # Standard error for all nymphs.
+            total_nymphs.std_error = apply((YoungNymphs.replications+OldNymphs.replications) / sqrt(opt$replications), 1, sd);
+            temperature_data_frame = append_vector(temperature_data_frame, total_nymphs.std_error, "TOTALNYMPHSE");
         }
     }
 }
 if (process_adults) {
     # Calculate adult populations for selected life stage.
     for (life_stage_adult in life_stages_adult) {
-        if (life_stage_adult=="Total") {
-            # Mean value for all adults.
-            total_adults = apply((Previttelogenic.replications+Vittelogenic.replications+Diapausing.replications), 1, mean);
-            temperature_data_frame = append_vector(temperature_data_frame, total_adults, "TOTALADULT");
-            # Standard error for all adults.
-            total_adults.std_error = apply((Previttelogenic.replications+Vittelogenic.replications+Diapausing.replications), 1, sd) / sqrt(opt$replications);
-            temperature_data_frame = append_vector(temperature_data_frame, total_adults.std_error, "TOTALADULTSE");
-        } else if (life_stage_adult == "Pre-vittelogenic") {
+        if (life_stage_adult == "Pre-vittelogenic") {
             # Mean value for previttelogenic adults.
             previttelogenic_adults = apply(Previttelogenic.replications, 1, mean);
             temperature_data_frame = append_vector(temperature_data_frame, previttelogenic_adults, "PRE-VITADULT");
@@ -1112,6 +1105,13 @@
             # Standard error for vittelogenic adults.
             diapausing_adults.std_error = apply(Diapausing.replications, 1, sd) / sqrt(opt$replications);
             temperature_data_frame = append_vector(temperature_data_frame, diapausing_adults.std_error, "DIAPAUSINGADULTSE");
+        } else if (life_stage_adult=="Total") {
+            # Mean value for all adults.
+            total_adults = apply((Previttelogenic.replications+Vittelogenic.replications+Diapausing.replications), 1, mean);
+            temperature_data_frame = append_vector(temperature_data_frame, total_adults, "TOTALADULT");
+            # Standard error for all adults.
+            total_adults.std_error = apply((Previttelogenic.replications+Vittelogenic.replications+Diapausing.replications), 1, sd) / sqrt(opt$replications);
+            temperature_data_frame = append_vector(temperature_data_frame, total_adults.std_error, "TOTALADULTSE");
         }
     }
 }
--- a/insect_phenology_model.xml	Fri Mar 09 13:41:38 2018 -0500
+++ b/insect_phenology_model.xml	Mon Mar 12 09:15:16 2018 -0400
@@ -123,23 +123,23 @@
             <param name="plot_egg_life_stage" value="no" />
             <param name="life_stages_nymph" value="Young" />
             <param name="life_stages_adult" value="Pre-vittelogenic" />
-            <output name="output" file="output1.csv" ftype="csv"/>
+            <output name="output" file="output1.csv" ftype="csv" compare="contains"/>
             <output_collection name="output_collection" type="list">
-                <element name="02_young_nymph_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="05_pre-vittelogenic_adult_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
+                <element name="02_young_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="05_pre-vittelogenic_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
             </output_collection>
         </test>
-        <!--
         <test>
             <param name="input" value="state_college.csv" ftype="csv" />
             <param name="location" value="State College PA" />
             <param name="replications" value="2" />
             <param name="plot_generations_separately" value="no" />
+            <output name="output" file="output2.csv" ftype="csv" compare="contains"/>
             <output_collection name="output_collection" type="list">
-                <element name="01_egg_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="04_total_nymph_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="08_total_adult_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="09_total_pop.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
+                <element name="01_egg_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="04_total_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="08_total_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="09_total_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
             </output_collection>
         </test>
         <test>
@@ -149,22 +149,23 @@
             <param name="plot_egg_life_stage" value="no" />
             <param name="life_stages_nymph" value="Old" />
             <param name="plot_adult_life_stage" value="no" />
+            <output name="output" file="output3.csv" ftype="csv" compare="contains"/>
             <output_collection name="output_collection" type="list">
-                <element name="03_old_nymph_pop_by_generation.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
+                <element name="03_old_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
             </output_collection>
         </test>
         <test>
             <param name="input" value="state_college.csv" ftype="csv" />
             <param name="location" value="State College PA" />
             <param name="replications" value="2" />
+            <output name="output" file="output4.csv" ftype="csv" compare="contains"/>
             <output_collection name="output_collection" type="list">
-                <element name="01_egg_pop_by_generation.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="04_total_nymph_pop_by_generation.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="08_total_adult_pop_by_generation.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
-                <element name="09_total_pop_by_generation.pdf" file="pop_by_generation.pdf" ftype="pdf" compare="contains"/>
+                <element name="01_egg_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="04_total_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="08_total_adult_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
+                <element name="09_total_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/>
             </output_collection>
         </test>
-        -->
     </tests>
     <help>
 **What it does**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output1.csv	Mon Mar 12 09:15:16 2018 -0400
@@ -0,0 +1,1 @@
+"LATITUDE","LONGITUDE","DATE","DOY","TMIN","TMAX","DAYLEN","YOUNGNYMPH","YOUNGNYMPHSE","PRE-VITADULT","PRE-VITADULTSE"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output2.csv	Mon Mar 12 09:15:16 2018 -0400
@@ -0,0 +1,1 @@
+"LATITUDE","LONGITUDE","DATE","DOY","TMIN","TMAX","DAYLEN","EGG","EGGSE","TOTALNYMPH","TOTALNYMPHSE","TOTALADULT","TOTALADULTSE"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output3.csv	Mon Mar 12 09:15:16 2018 -0400
@@ -0,0 +1,1 @@
+"LATITUDE","LONGITUDE","DATE","DOY","TMIN","TMAX","DAYLEN","OLDNYMPH","OLDNYMPHSE"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output4.csv	Mon Mar 12 09:15:16 2018 -0400
@@ -0,0 +1,1 @@
+"LATITUDE","LONGITUDE","DATE","DOY","TMIN","TMAX","DAYLEN","EGG","EGGSE","TOTALNYMPH","TOTALNYMPHSE","TOTALADULT","TOTALADULTSE"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/plot.pdf	Mon Mar 12 09:15:16 2018 -0400
@@ -0,0 +1,52 @@
+%PDF
+1 0 obj
+<<
+/CreationDate
+/ModDate
+/Title (R Graphics Output)
+/Producer
+/Creator (R)
+<< /Type /Catalog /Pages 3 0 R >>
+endobj
+7 0 obj
+<< /Type /Page /Parent 3 0 R /Contents 8 0 R /Resources 4 0 R >>
+endobj
+3 0 obj
+<< /Type /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 1440 2160] >>
+endobj
+4 0 obj
+<<
+/ProcSet [/PDF /Text]
+/Font <</F2 10 0 R /F3 11 0 R >>
+/ExtGState << >>
+/ColorSpace << /sRGB 5 0 R >>
+>>
+endobj
+5 0 obj
+[/ICCBased 6 0 R]
+endobj
+6 0 obj
+<< /Alternate /DeviceRGB /N 3 /Length 2596 /Filter /FlateDecode >>
+stream
+endobj
+9 0 obj
+<<
+/Type /Encoding /BaseEncoding /WinAnsiEncoding
+/Differences [ 45/minus 96/quoteleft
+144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
+/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
+>>
+endobj
+10 0 obj
+<< /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica
+/Encoding 9 0 R >>
+endobj
+11 0 obj
+<< /Type /Font /Subtype /Type1 /Name /F3 /BaseFont /Helvetica-Bold
+/Encoding 9 0 R >>
+endobj
+xref
+trailer
+<< /Size 12 /Info 1 0 R /Root 2 0 R >>
+startxref
+%%EOF
--- a/test-data/pop_by_generation.pdf	Fri Mar 09 13:41:38 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-%PDF
-1 0 obj
-<<
-/CreationDate
-/ModDate
-/Title (R Graphics Output)
-/Producer
-/Creator (R)
-<< /Type /Catalog /Pages 3 0 R >>
-endobj
-7 0 obj
-<< /Type /Page /Parent 3 0 R /Contents 8 0 R /Resources 4 0 R >>
-endobj
-3 0 obj
-<< /Type /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 1440 2160] >>
-endobj
-4 0 obj
-<<
-/ProcSet [/PDF /Text]
-/Font <</F2 10 0 R /F3 11 0 R >>
-/ExtGState << >>
-/ColorSpace << /sRGB 5 0 R >>
->>
-endobj
-5 0 obj
-[/ICCBased 6 0 R]
-endobj
-6 0 obj
-<< /Alternate /DeviceRGB /N 3 /Length 2596 /Filter /FlateDecode >>
-stream
-endobj
-9 0 obj
-<<
-/Type /Encoding /BaseEncoding /WinAnsiEncoding
-/Differences [ 45/minus 96/quoteleft
-144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
-/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
->>
-endobj
-10 0 obj
-<< /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica
-/Encoding 9 0 R >>
-endobj
-11 0 obj
-<< /Type /Font /Subtype /Type1 /Name /F3 /BaseFont /Helvetica-Bold
-/Encoding 9 0 R >>
-endobj
-xref
-trailer
-<< /Size 12 /Info 1 0 R /Root 2 0 R >>
-startxref
-%%EOF