Commit bc6d6dd2 authored by patrick.lambert's avatar patrick.lambert
Browse files

Merge branch 'exploration_GR3D_process' of...

Merge branch 'exploration_GR3D_process' of gitlab-ssh.irstea.fr:SimAquaLife/GR3D into SpawnerRunAnalysis
parents 51b0fdb8 a744b2a8
......@@ -20,6 +20,7 @@
package analysis;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -162,7 +163,7 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
if (nbAgeForPrimiparousFemale > 0.)
ageOfPrimiparousFemaleMemories.get(riverBasin)
.push(meanAgeForPrimiparousFemale / nbAgeForPrimiparousFemale);
.push(meanAgeForPrimiparousFemale / nbAgeForPrimiparousFemale);
else
ageOfPrimiparousFemaleMemories.get(riverBasin).push(Double.NaN);
if (nbAgeForPrimiparousMale > 0.)
......@@ -202,31 +203,33 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
TreeMapForCentile ageEffective = new TreeMapForCentile();
Double[] range = new Double[3];
double sum = 0;
double nb = 0;
double ageMin = 100.;
double ageMax = 0.;
for (RiverBasin riverBasin : riverBasins) {
for (DiadromousFish fish : riverBasin.getFishs(group)) {
if (fish.getStage() == Stage.MATURE & fish.getGender() == gender)
if (fish.getStage() == Stage.MATURE & fish.getGender() == gender) {
if (fish.getAge() < ageMin)
ageMin = fish.getAge();
if (fish.getAge() > ageMax)
ageMax = fish.getAge();
if (fish.getAge() > ageMax)
ageMax = fish.getAge();
ageEffective.putWithAdding(fish.getAge(), fish.getAmount());
nb += fish.getAmount();
sum += fish.getAge() * fish.getAmount();
ageEffective.putWithAdding(fish.getAge(), fish.getAmount());
}
}
}
// (y, y-low, y-high) data item
// range[0] = sum / nb;
range[0] = ageEffective.calculateMedian();
range[1] = ageMin;
range[2] = ageMax;
// System.out.println(Arrays.toString(range));
if (!ageEffective.isEmpty()) {
range[0] = ageEffective.calculateMedian();
range[1] = ageMin;
range[2] = ageMax;
}
else {
range[0] = Double.NaN;
range[1] = Double.NaN;
range[2] = Double.NaN;
}
System.out.println(Arrays.toString(range));
return range;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment