Commit 3e87ea80 authored by pfreon's avatar pfreon
Browse files

Improvement of transitional states for models catchability

For models with the influence of V on catchability only, the beginning and end of the effect was not taken into account when the model was fitted directly (only the number of year classes was asked). Now the age at recruitment is asked and the age at the beginning and end of V influence is deduced.
parent 794cbe77
......@@ -338,7 +338,7 @@ public class Cadre_ModeleDirect extends JFrame {
ejecutar al abrir la ventana.
*/
displayList(RechercheModele.getlisteModele(0));
EnvironmentsetEnabled(false);
EnvironmentsetEnabled(false, false);
Global.environmental_influence = Global.influenceEnv[0];
Global.envir_preponderant = 1;
//System.out.println("Flag 0 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -347,7 +347,7 @@ public class Cadre_ModeleDirect extends JFrame {
void chkE_actionPerformed(ActionEvent e) { // Case CPUE=f(E).
displayList(RechercheModele.getlisteModele(0));
EnvironmentsetEnabled(false);
EnvironmentsetEnabled(false, false);
Global.environmental_influence = Global.influenceEnv[0];
Global.envir_preponderant = 1;
//System.out.println("Flag 1 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -355,7 +355,7 @@ public class Cadre_ModeleDirect extends JFrame {
void chkV_actionPerformed(ActionEvent e) { // Case CPUE=f(V).
displayList(RechercheModele.getlisteModele(1));
EnvironmentsetEnabled(true);
EnvironmentsetEnabled(true,true);
Global.environmental_influence = Global.influenceEnv[0];
Global.envir_preponderant = 2;
//System.out.println("Flag 2 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -363,7 +363,8 @@ public class Cadre_ModeleDirect extends JFrame {
void chkEVCatchability_actionPerformed(ActionEvent e) { // Case CPUE=f(E,V) effect on catchabilty.
displayList(RechercheModele.getlisteModele(2));
EnvironmentsetEnabled(false);
EnvironmentsetEnabled(true, false);
Environmentset2Enabled(true);
Global.environmental_influence = Global.influenceEnv[2];
Global.envir_preponderant = -1;
//System.out.println("Flag 3 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -371,7 +372,7 @@ public class Cadre_ModeleDirect extends JFrame {
void chkEVAbundance_actionPerformed(ActionEvent e) { // Case CPUE=f(E,V) effect on abundance.
displayList(RechercheModele.getlisteModele(3));
EnvironmentsetEnabled(true);
EnvironmentsetEnabled(true, true);
Global.envir_preponderant = -1;
Global.environmental_influence = Global.influenceEnv[1];
//System.out.println("Flag 4 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -379,7 +380,7 @@ public class Cadre_ModeleDirect extends JFrame {
void chkEVBoth_actionPerformed(ActionEvent e) { // Case CPUE=f(E,V) effect on both.
displayList(RechercheModele.getlisteModele(4));
EnvironmentsetEnabled(true);
EnvironmentsetEnabled(true, true);
Global.envir_preponderant = -1;
Global.environmental_influence = Global.influenceEnv[3];
//System.out.println("Flag 5 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......@@ -538,16 +539,20 @@ private void displayList(String[] liste) {
}
}
private void EnvironmentsetEnabled(boolean b) {
private void EnvironmentsetEnabled(boolean a, boolean b) {
jcboRecrutement.setEnabled(b);
jcboRecrutement.setEnabled(a);
jcboBegining.setEnabled(b);
jcboEnd.setEnabled(b);
jlblRecrutement.setEnabled(b);
jlblBegining.setEnabled(b);
jlblEnd.setEnabled(b);
}
private void Environmentset2Enabled(boolean b) {
jcboRecrutement.setEnabled(b);
jlblRecrutement.setEnabled(b);
}
void cmdFit_actionPerformed(ActionEvent e) {
try {
MsgDialogBox msg;
......
......@@ -3,6 +3,7 @@
* Lecture des données du fichier *.CLI, recheche d'erreurs ou insuffisance,
* calcul de la CPUE et des statistiques de base (sans décalage),
* prend en compte les décalages temporels lorsque nécessaire,
* calcule les valeurs moyennes pondérées de V,
* affiche les graphiques de base (time plots, bivariate plots) sur les
* données brutes avec décalage si nécessaire.
*/
......@@ -227,16 +228,19 @@ public class Data {
return -1;
}
}
/**
* Construit le tableau des données à ajuster en fonction des décalages
* et du calcul des moyennes pondérées de E et de V.
*/
public static void init_val() {
int i, d;
calcul_coeff();
int nim = nbData - decalmax;
// System.out.println("nim " + nim);
year = new double[nim];
yexp = new double[nim];
yexp = new double[nim]; // Catches
pue = new double[nim];
f = new double[nim];
f = new double[nim]; // Effort
v = new double[nim];
vbar = new double[nim];
for (i = 0; i < nim; i++) {
......@@ -250,21 +254,26 @@ public class Data {
vbar[i] += data[i + decalmax - d][3] * vcoeff[d];
}
pue[i] = yexp[i] / data[i + decalmax][2];
//System.out.println(data[i+decalmax][0]+"*"+yexp[i]+"*"+v[i]+"*"+f[i]+"*"+vbar[i]+"*"+ pue[i]);
System.out.println(data[i+decalmax][0]+"*"+yexp[i]+"*"+v[i]+"*"+f[i]+"*"+vbar[i]+"*"+ pue[i]);
}
makePlot(true);
}
/**
*
*Calcul des coefficients par classe d'àage et par an servant au calcul
* des moyennes pondérées de E (fcoeff) et de V (vcoeff)
*/
private static void calcul_coeff() {
int nbexploit = Global.nb_classes_exploitees;
int agerec = Global.recruitment_age;
int begining = Global.begin_influence_period;
int ending = Global.end_influence_period;
//System.out.println(nbexploit+"****"+agerec+ "**********" +begining+"******"+ending);
if (Global.environmental_influence == "catchability")
{ begining = agerec;
ending = agerec + nbexploit -1;
}
System.out.println(nbexploit+"****"+agerec+ "**********" +begining+"******"+ending);
/*int nbexploit=Integer.parseInt((String)Global.htVar.get("nb_classes_exploitees"));
int agerec=Integer.parseInt((String)Global.htVar.get("recruitment_age"));
......@@ -304,6 +313,7 @@ public class Data {
//System.out.println("In Data.java ligne 298 nbexploit = " + nbexploit + "*** agerec = "+ agerec + "*** begining = " + begining + "****ending = "+ ending);
//System.out.println("*** ageder =" + ageder + "decalmax = " + decalmax);
if (begining == -1) begining = 0;
//System.out.println("begining = " + begining);
for (int i = 0; i < nbexploit; i++) {
for (int d = begining; d <= ending; d++) {
t[i][d + i] = 1;
......@@ -313,9 +323,9 @@ public class Data {
for (int d = 0; d < ageder + 1; d++) {
for (int i = 0; i < nbexploit; i++) {
vcoeff[ageder - d] += t[i][d];
// System.out.println(ageder-d+"***"+vcoeff[d]);
// System.out.println(ageder-d+"***"+vcoeff[d]);
dtot += t[i][d];
//System.out.println("dtot "+i+" " +d +" " +dtot);
// System.out.println("dtot "+i+" " +d +" " +dtot);
}
}
for (int d = 0; d < ageder + 1; d++) {
......@@ -367,7 +377,7 @@ public class Data {
double minx = Stat1.min(Data.year);
Global.TimeStepData = Data.year[1] - Data.year[0]; // Time step of the row data (default Year, decimal intervals mean seasonal data
System.out.println("Global.TimeStepData = " + Global.TimeStepData);
//System.out.println("Global.TimeStepData = " + Global.TimeStepData);
if (Global.TimeStepData >= 1.0) {
Global.TimeStepData$ = "Full year or single annual season";
}
......
Supports Markdown
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