Author: echatellier Date: 2015-10-28 14:58:16 +0100 (Wed, 28 Oct 2015) New Revision: 379 Url: http://forge.codelutin.com/projects/isis-fish-data/repository/revisions/379 Log: Remove pop dimension in F result Modified: trunk/scripts/SiMatrix.java Modified: trunk/scripts/SiMatrix.java =================================================================== --- trunk/scripts/SiMatrix.java 2015-10-27 16:36:34 UTC (rev 378) +++ trunk/scripts/SiMatrix.java 2015-10-28 13:58:16 UTC (rev 379) @@ -1158,13 +1158,12 @@ double Mgroup = 0; double NgroupRef = 0; - List<Population> populations = Collections.singletonList(pop); List<PopulationGroup> groups = pop.getPopulationGroup(); MatrixND tfgMatrix = MatrixFactory.getInstance().create( MatrixFishingMortalityPerGroup.NAME, - new List[]{populations, groups}, // On travaille sur les pops ET les groupes - new String[]{n("Population"), n("Group")}); + new List[]{groups}, // On travaille sur les groupes + new String[]{n("Group")}); for (PopulationGroup group : groups) { @@ -1195,12 +1194,8 @@ catchPerStrategy = catchPerStrategy.sumOverDim(0); // Strategy catchPerStrategy = catchPerStrategy.sumOverDim(1); // Metier catchPerStrategy = catchPerStrategy.sumOverDim(3); // Zone : une pop peut avoir plusieurs zonespop dans ISIS - List semgroup = catchPerStrategy.getSemantic(2); - catchPerStrategy = catchPerStrategy.reduce(); // Enleve les dimensions de taille 1 - catchPerStrategy.setSemantic(0, semgroup); // Ne plait pas a Eric + catchPerStrategy = catchPerStrategy.reduceDims(0, 1, 3); // Enleve les dimensions de taille 1 Cgroup = catchPerStrategy.getValue(group); - //log.info("Cgroup = " + Cgroup + "Year=" + step.getYear()); - //log.info("catchPerStrategy = " + catchPerStrategy + "Year=" + step.getYear()); // compute total mortality by suming naturalDeathRate and fishingMortalityOtherFleetsMatrix MatrixND naturalDeathRatePop = pop.getNaturalDeathRateMatrix(); @@ -1217,7 +1212,8 @@ abundanceReferenceMonth = Month.JANUARY; } TimeStep refStep = new TimeStep(12 * step.getYear() + abundanceReferenceMonth.getMonthNumber()); - MatrixND abundancePopRef = resManager.getMatrix(refStep, pop, MatrixAbundanceBeginMonth.NAME); // Le timestep 0 correspond a janvier de la premiere annee et les annees sont numerotees a partir de zero + // Le timestep 0 correspond a janvier de la premiere annee et les annees sont numerotees a partir de zero + MatrixND abundancePopRef = resManager.getMatrix(refStep, pop, MatrixAbundanceBeginMonth.NAME); abundancePopRef = abundancePopRef.sumOverDim(1); // somme sur Zone abundancePopRef = abundancePopRef.reduce(); NgroupRef = abundancePopRef.getValue(group); @@ -1224,22 +1220,16 @@ //log.info("NgroupRef = " + NgroupJan + "Year=" + step.getYear()); ObjectiveFunction f = new ObjectiveFunctionBaranov(Cgroup, Mgroup, NgroupRef); - Fgroup = MinimisationUtil.fmin(0.0,2.0,1.0e-10, f); // step ?? + Fgroup = MinimisationUtil.fmin(0.0, 2.0, 1.0e-10, f); // step ?? - //log.info("Fgroup = " + Fgroup); + tfgMatrix.setValue(group, Fgroup); // Bien faire attention a l'endroit ou on met cette etape (quelle boucle) ? - tfgMatrix.setValue(pop, group, Fgroup); // Bien faire attention a l'endroit ou on met cette etape (quelle boucle) ? - } else { //Fgroup = 0; // Ce n'est plus une valeur unique mais une matrice, est-ce que cette notation peut fonctionner ? - tfgMatrix.setValue(pop, group, 0); // Bien faire attention a l'endroit ou on met cette etape (quelle boucle) ? + tfgMatrix.setValue(group, 0); // Bien faire attention a l'endroit ou on met cette etape (quelle boucle) ? } } - //log.info("tfgMatrix = " + tfgMatrix); - //log.info("tfg.DimensionNames = " + Arrays.toString(tfgMatrix.getDimensionNames())); - //log.info("tfg.Semantics = " + Arrays.toString(tfgMatrix.getSemantics())); - return tfgMatrix; } @@ -1251,23 +1241,19 @@ public MatrixND totalFishingMortality(TimeStep step, Population pop, MatrixND fishingMortalityPerGroup) throws TopiaException { MatrixND tfmMatrix = fishingMortalityPerGroup.copy(); tfmMatrix.setName(MatrixTotalFishingMortality.NAME); - //log.info("tfmMatrix = " + tfmMatrix); List<PopulationGroup> groups = pop.getPopulationGroup(); int groupMin = pop.getFbarGroupMin(); int groupMax = pop.getFbarGroupMax(); - int Nbre = (int)groupMax - (int)groupMin + 1; - //log.info("Nbre = " + Nbre); + int groupCount = (int)groupMax - (int)groupMin + 1; for (PopulationGroup group : groups) { if (group.getId() == groupMin) { // MatrixND getSubMatrix(int dim, Object, int nb) - tfmMatrix = tfmMatrix.getSubMatrix(1, group, Nbre); - tfmMatrix = tfmMatrix.meanOverDim(1); + tfmMatrix = tfmMatrix.getSubMatrix(0, group, groupCount); + tfmMatrix = tfmMatrix.meanOverDim(0); tfmMatrix = tfmMatrix.reduce(); - //log.info("tfm.DimensionNames = " + Arrays.toString(tfmMatrix.getDimensionNames())); - //log.info("tfm.Semantics = " + Arrays.toString(tfmMatrix.getSemantics())); } }
participants (1)
-
echatellier@users.forge.codelutin.com