trophia / sna1

A model of the SNA1 fishery
2 stars 2 forks source link

IBM features to be implemented #17

Open bianrq opened 7 years ago

bianrq commented 7 years ago
  1. Implement a control parameter file for specifying alternate IBM runs and tagging sequencies
  2. Implement variability in compositional data sets (age and length sampling) and abundance (CPUE) series
  3. Implement a process to make tagged fish true individuals while preserving agent dynamics of untagged population
  4. Implement trap avoidance process for tagged fish
  5. Implement: tag mortality; and tag loss; and tag non-detection
  6. Check time scale of IBM Markovian movement matrix (should be specified as annual proportional movement)
nokome commented 7 years ago

@bianrq @mckenziej : I have added more parameters to the file inputs/parameters.json. The names should be self explanatory, if in doubt check the parameters.hpp source file for documentation. I will add other parameters later today e.g. tag release schedule.

As mentioned previously it is in JSON which has a fairly obvious format. If you do get an error due to wrong syntax you might like to use an online tool like https://jsonlint.com/ to check where the problem is.

Also, I have now added more outputs e.g. tagging data, casal inout files etc. When you run the model i.e. make run you will get these outputs in the output folder (NB. these a separate to the outputs done specifically for unit tests which are output in various subdirectories in tests).

bianrq commented 7 years ago

Thanks Nokome.

Jeremy asked me to do a compile and I got an error, please check your email to see a screenshot of the error message. Jeremy wanted to know how to get variable year class strengths and I wanted to know if I choose "e" for fishes_growth_model, how do I specify g-alpha and g-beta for given alpha and beta (hardwired as 20 and 50?).

nokome commented 7 years ago

Hi Richard,

make test-slow
g++ -std=c++11 -Wall -Wno-unused-function -Wno-unused-local-typedefs -Wno-unused-variable -pthread -O3 -I. -Irequires/boost -Irequires/stencila -otests-slow.exe tests/tests-slow.cpp -Lrequires/boost/lib -lboost_system -lboost_filesystem  -lboost_unit_test_framework
time ./tests-slow.exe
make run
g++ -std=c++11 -Wall -Wno-unused-function -Wno-unused-local-typedefs -Wno-unused-variable -pthread -O3 -I. -Irequires/boost -Irequires/stencila -osna1.exe sna1.cpp -Lrequires/boost/lib -lboost_system -lboost_filesystem 
time ./sna1.exe run
    "fishes_growth_model": "l",
    "fishes_k_mean": 0.1,
    "fishes_k_sd": 0.02,
    "fishes_linf_mean": 60,
    "fishes_linf_sd": 10
bianrq commented 7 years ago

The commands are helpful, both working.

But when I ran the tests-slow.exe, I got an fatal error and no output files were generated. Please find the screenshot for the run in my email.

nokome commented 7 years ago

Great. Yes, the problem that you see with tests-slow.exe must have been introduced by the recent chages - it is happening on Travis too: https://travis-ci.org/trophia/sna1#L1691 . I will try to fix ASAP.

In any case use ./sna1.exe run for now on for most of your work doing runs with alternative parameter vlues.

By the way, you can paste a screenshot in one of these comments and it will get display (see the Preview tab)

nokome commented 7 years ago

@mckenziej @bianrq : I've added rec strengths as parameters. Can you please:

nokome commented 7 years ago

@mckenziej @bianrq : I've done a similar thing for catch history (the ability to set the catch history was always there but I've made the file structure more similar to other model inputs and added some instructions to the readme: https://github.com/trophia/sna1#inputharvest_catch_historytsv)

As with rec_strengths could you have a look to see if this makes sense.

nokome commented 7 years ago

Done same for movement: https://github.com/trophia/sna1#inputfishes_movementtsv

bianrq commented 7 years ago

@nokome : Thanks for the update. Just did a run and got an error as below. run error

nokome commented 7 years ago

@bianrq : mmm, looks like it's an error when trying to write the output files at the end of the simulation. Can you confirm that you have write access by trying touch output/temp.txt and checking that made a file in the output folder

nokome commented 7 years ago

@mckenziej : I've setup the tagging config: can you have a look at https://github.com/trophia/sna1#tagging and see if that has what you need.

bianrq commented 7 years ago

@nokome you are right. I have to add sudo to be able to do it. check write access

nokome commented 7 years ago

@bianrq : if you fix that permissions issue it would be best (something to do with your VM setup?), alternatively you could try sudo make run to do everything using sudo.

bianrq commented 7 years ago

@nokome : it runs if I add sudo in front of the command for a run mode. I still have an error message from a test run. test mode error

nokome commented 7 years ago

@bianrq : yes, the test run is still broken - instead I'm focusing on implementing everything you need to do customised runs by changing input parameters. So don't worry about the make test for now. Instead try setting parameters in the input files, make run and then look at the output files.

nokome commented 7 years ago

In the latest commits I've implemented, and added parameters for, tagging mortality and tag shedding: see https://github.com/trophia/sna1/blob/master/input/parameters.json#L29

bianrq commented 7 years ago

@nokome : am I right if I assume the .tsv files in sna1/output/monitor/casal/ generated from a run mode should be the same as those in sna1/tests/casal/ibm-outputs/ generated from a test run? The age.tsv files in the two folder look different from each other, so I was trying to get a new test run and see if they are the same or not.

nokome commented 7 years ago

They should be the same. I'll look into it

nokome commented 7 years ago

Hi @bianrq : the file in output/monitor/casal/ have the same structure as those in tests/casal/ibm-outputs but they will have different values. That is because the during the test we set some parameters to ensure they match CASAL assumptions e.g.

    // Ensure parameters are set to match the assumptions of CASAL
    // Only temporal variation in growth
    parameters.fishes_growth_variation = 't';
    // No movement
    parameters.fishes_movement_type = 'n';
    // No MLS
    parameters.harvest_mls = 0;

You could set those parameters to be the same in input/parameters.json but even then the values in the output files would be different because of the stochastic nature of the model.

bianrq commented 7 years ago

@nokome : attached is the age.tsv file I got from a 'run' mode run. there are many count are 0s for many years. I don't know why they are 0s and how to change them. I change tsv to txt to be able to attach. age.txt

nokome commented 7 years ago

Actually, I'm working on the specification and output of alternative monitoring now (so you don't gt all those zero). Should be one in the next half hour - I'll let you know when it is done.

bianrq commented 7 years ago

@nokome : I've done a few runs and with the catch at age (age.tsv), casal doesn't fit well. It looks to me that the current code tends to catch younger fish than before. Attached please find three catch at age files, the two from normal runs are from the current code for mls = 0 and mls 25. the third one was created from test run of the early version code. age run mls 0.txt age run mls 25.txt age test-slow.txt