gadget-framework / gadget2 Goto Github PK
View Code? Open in Web Editor NEWGadget is the Globally applicable Area Disaggregated General Ecosystem Toolbox
License: GNU General Public License v2.0
Gadget is the Globally applicable Area Disaggregated General Ecosystem Toolbox
License: GNU General Public License v2.0
When defining a stock length aggregations are required for both the growth and the consumption process. This is done to speed up calculations when the aggregations are defined on coarser scale than the model. Defining these files however is typically a nuisance as the most common scenarios the are the same files and they correspond to the length groups defined in the header. I suggest that the definition of these should be made optional.
Food availability and consumption are highly relevant for cod growth in the Baltic.
To account for this feedback in my cod-sprat-herring model I'm using the 'WeightJones" growth for cod.
In the manual under consumption I can read that "The summation over preys is over all preys that the predator consumes, including non-modelled prey, given as otherfood”
Questions:
In the readme file (README.md) the link to the diagram showing features of Gadget is broken.
Error: Not Found
See below:
I have a 2 stock model of a single species (immature and mature) with doesspawn==1 in the mature stock. I'd like to have the mature stock spawn recruits into the immature stock, but the model only seems to work when I specify the mature stock in spawnstocksandratios (i.e. when I specify the immature stock in spawnstocksandratios, then population goes exctinct after first 2 years of model due to receiving no recruits). Here is what my spawnfile looks like with the model that does NOT work.
; Generated by Rgadget 0.5
spawnsteps 1
spawnareas 1
firstspawnyear 1980
lastspawnyear 2010
spawnstocksandratios imm 1
proportionfunction exponential #mat.spawn.alpha #mat.spawn.l50
mortalityfunction constant 0
weightlossfunction constant 0
recruitment bevertonholt #mat.bh.mu #mat.bh.lam
stockparameters #mat.linf #mat.k 2.1e-06 3.3437
When I change spawnstocksandratios
to spawnstocksandratios mat 1
then the population of the mature stock persists, but the immature stock crashes and remains at 0 after all individuals have entered into the mature population (i.e. there are no recruits coming into the immature stock).
How do I make the mature stock spawn, but have those recruits go into the immature population?
The Gadget User Guide is vague on how to specify this. Note that I have tried the following:
spawnstocksandratios imm 1 mat 0
spawnstocksandratios imm 1
mat 0
There have been some discrepancies observed between the windows version of Gadget and the linux version. In light of that there is a need to define a few representative test cases and test the output.
I'm working with the consumption module in Gadget. The manual says "Note that the maximum consumption should be specified in kilojoules per month" (explanation for eq. 4.22).
Is it really "per month" or should it be "per timestep"?
Thanks for any clarification
\Valerio
Hello, here another question.
I am using the survey index at age as likelihood components with a loglinearfit type.
My question is about the parameters intercept and slope. As far as I know what you compare with the observed index is not the Nt directly but intercept+slope*Nt, as it is indicated in the equation to estimate the loglikelihood score.
Then, the numbers in the file are the final survey index? Do I have to use the slope and intercept to transform the numbers in the table somehow?
Thanks,
Alfonso.
Hi I am using Cygwin64 on windows 10 to run the gadget.
After I have successfully installed the executable file when I run "gadget " as suggested from the Userguide, it returns "-bash: syntax error near unexpected token `newline'".
Do you know what is going wrong here?
Gadget models growth by year, while we know that the growth function should be modelled by cohort. This is not a problem if growth (size at age) is constant over time. All cohorts would have the same growth curve, and hence no strong deviations (observed-estimated size at age) would be expected if growth is modeled by year instead of by cohort.
However, when the growth rate at age changes over time (changes in growth between cohorts, induced by density dependence, strong water temperature changes, food availability...) the mean size at age in the stock will be very different from the mean size at age estimated by the Beverton and Holt modeled annually in gadget. Even worse, it is common that a few consecutive cohorts experience similar factors affecting growth and hence will have similar growth curves. This will be translated in a clear patterns with consecutive years of higher or lower size at age than that predicted by the annual beverton and holt curve.
This problem can be very serious since it can produce strong deviations of the estimated population size distribution by gadget from those observed in the data (survey or catches), which, once translated to biomass can suppose strong differences in the total estimated stock biomass and spawning stock biomass (which is very affected by the growth function). A 10 cm difference in size may imply 1-2 kg of biomass per individual depending on the fish size and the species.
In XSA each age is assigned an average weight that comes from survey and commercial data. Is there any possiblity to assigned by hand an average weight by timestep (either year, season or month) by hand so the problems derived from changes in growth over time is avoided?
Thanks in advance.
Alfonso.
Does anyone know the correct syntax for specifying different values of natural mortality during different years and/or timesteps in Gadget? Or if it's even possible. I feel as though this should be capable by adding a "mortality file" to the stockfile as below, but am not quite sure about the syntax. The user guide only states that a vector of mortalities may be given:
Stockfile
stockname zebrafish
livesonareas 1
...
maxlengthgroupgrowth 15
naturalmortality mortfile
iseaten 0
...
mortfile
timedata stockdata
2000 0.2
2001 0.2
...
Note that I came to the above file structure through trial and (gadget) error(s).
When naturalmortality mortfile
is specified, but say a vector of natural mortalities is given (a value for each age) then gadget spits an error that states Expected timedata or stockdata but found instead 0.2
I've been unable to run gadget.fit with stocks where doesspawn was specified instead of doesrenew. Perhaps it is an issue with a newer version of gadget (I'm running a version downloaded on 29th of May with updated stomachcontent.cc file), R or one of the packages?
The error:
Joining, by = c(".id", "length")
Joining, by = c("year", "area", "fleet")
Joining, by = c("year", "area")
Error in mutate_impl(.data, dots) : object 'area' not found
In addition: Warning messages:
1: In file(con, "r") : cannot open file '0': No such file or directory
2: In file(con, "r") : cannot open file '0': No such file or directory
Session info:
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] gridExtra_2.2.1 pander_0.6.0 Rgadget_0.5 purrr_0.2.2 stringr_1.2.0
[6] lubridate_1.6.0 data.table_1.10.4 dplyr_0.5.0 reshape2_1.4.2 plyr_1.8.4
[11] ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 digest_0.6.12 assertthat_0.2.0 R6_2.2.0 gtable_0.2.0 DBI_0.6-1
[7] magrittr_1.5 scales_0.4.1 stringi_1.1.5 lazyeval_0.2.0 tools_3.4.0 munsell_0.4.3
[13] compiler_3.4.0 colorspace_1.3-2 tibble_1.3.0
The intention here is to include the effect of some external variable in the SR relationship.
If I replace the parameter mu
of the Ricker model in the spawnfile with a timeVariable like below I get the error:
Error in timevariable - nothing specified for first timestep of the simulation
spawnfile:
spawnsteps 2
spawnareas 1
firstspawnyear 1991
lastspawnyear 2013
spawnstocksandratios spratimm 1
proportionfunction constant 1
mortalityfunction constant 0
weightlossfunction constant 0
recruitment ricker Modelfiles/sprat.mu 5.192e-10
stockparameters 7.7 0.9 4.363603e-05 2.611152
TimeVariable file:
spratmu ; time variable mu = multiplier * value
multiplier 4.003
timedata
; year step value
1991 1 16.25
1992 1 16.40
1993 1 14.99
1994 1 16.55
1995 1 16.43
... ... ...
I'm trying to add a stomach LH in a 2 species model (cod-sprat). I've tried 1 simulation in the terminal, I continue to get the same error and I haven't been able to figure out the reason.
Thankful for any suggestion where to look.
Finished reading model data files, starting to run simulation
Error when checking length structure for the following lengthgroups
Minimum length of length group division is 1
Maximum length of length group division is 137
Minimum length of length group division is 20
Maximum length of length group division is 100
Error in predatoraggregator - invalid predator length group structure
This is how I've set the lengths in the stockfiles and aggrfiles:
Also in the case of well specified models supported by good data, Gadget estimates are rarely (if ever) identical from two identical runs. No surprise, as this is the nature of the optimization procedure. In fact, once we've verified that estimates are "sufficiently" stable, seeding is a common practice for certain applications (ie assessment, multispecies keyruns).
However, resolving stability is not always easy and in some cases not possible given the available data and knowledge on the stock.
If thoroughly explored (with a sufficiently large number of runs) could this instability be explicitly represented (for instance with an ensemble) in the form of an uncertainty? What's the view of the Gadget community on this?
I was just wondering of the order of values in mathematical operations. Multiplication is easy, but what if we divide. In case (/ #a #b) would #a be divided by #b or #b divided by #a?
It is clear that a stockVariable can be used in place of a parameter approx. as follows:
#param ~ #multi * stkVar
What it is not clear to me is if and how I could implement something like this instead:
#param ~ #param1 + #multi * stkVar
I've tried without success
(+ #param1 stkVarFileName)
I have few situations where this could be rather useful.
As always thankful
I'm unable to compile gadget from the latest git revision (d610418) due to missing proglikelihood.h
file (and perhaps proglikelihood.cc
file as well?). Complete log follows:
$ make
g++ -D NDEBUG -D INTERRUPT_HANDLER -O3 -I headers/ -D NOT_WINDOWS -c -o src/initialize.o src/initialize.cc
src/initialize.cc:34:28: fatal error: proglikelihood.h: No such file or directory
#include "proglikelihood.h"
^
compilation terminated.
<builtin>: recipe for target 'src/initialize.o' failed
make: *** [src/initialize.o] Error 1
@bthe we talked at some point about turning this repo into an R package so the gadget executable can be installed via. install_github()
.
Not only would this be useful for rgadget users, it'd make an automated build of the gadget course documentation (and probably Rgadget) a lot easier, since we wouldn't have to have a separate build step to install Gadget before doing whatever we were going to do.
I'm assuming you'd like me to have a go at some point and see how easy it is?
Gadget has a problem with incomplete survey index data when number of areas is larger than 1 and data is not consistently missing within the same likelihood component. E.g. in a three area model the following datafile would result in a likelihood score of 1*10^10 regardless of the parametervalue:
; Generated by mfdb 4.0.0
; -- data --
; year step area length number
1976 1 area3 len40 310.4467
1978 1 area1 len40 155.255333333333
1978 1 area2 len40 235.7002725
1978 1 area3 len40 1209.91449
1979 1 area1 len40 1357.965
1979 1 area2 len40 458.677632
1979 1 area3 len40 1082.82543384615
1980 1 area2 len40 350.74494
1980 1 area3 len40 1388.49823636364
A easy fix for this problem is to split the likelihood components by area but Gadget should handle this problem more elegantly.
it is great to have the new ices quotafleet type which assumes a linear increase in the quota level between biomass breakpoints.
It may well be because of my limited understanding of C++, but in 3b3cdf0#diff-18472b59e896caad1e517b862b268d7d I do not find where (in the new as well as the old code) the quotalevel is set for biomass above the last breakpoint such as biomass > biomasslevel[biomasslevel.Size()]
Any help?
I just git cloned and compiled the most recent version of GADGET. It works great for the example here: ftp://ftp.hafro.is/pub/reiknid/dst2/gadget/haddock2.1.05.tar.gz
but when I call gadget on my older models I get the following errors.
gadget: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by gadget)
gadget: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by gadget)
gadget: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by gadget)
Any idea what the issue is?
Thanks,
Paul
I'm using a Gadget model to evaluate different aspects of a sampling design.
Unfortunately, I'm having problem in achieving a sufficiently stable estimation of the model parameters to evaluate if differences are the result of the sampling design.
I've tried the following with limited success:
Any other suggestion?
Thankful as always
Is there a reason why CatchStatistics LH does not accept an argument 'aggregationlevel' to aggregate data over the year like for CatchDistribution LH?
Sometimes historical data on weight-at-age are only available on an annual basis in the ICES assessments and this functionality would be pretty useful.
I've experienced this error when the catchstatistics likelihood component is pointing to two stocks. Few tests show that the error disappears when the likelihood points to only one stock or when the two stocks have the same age and length range. It seems a bug worth a fix
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.