Skip to content

Commit

Permalink
Merge pull request #14 from openworm/test_parameters_pg
Browse files Browse the repository at this point in the history
Working omv tests
  • Loading branch information
adampdp authored Jan 8, 2025
2 parents 783f8f3 + bd38507 commit 4087ed9
Show file tree
Hide file tree
Showing 22 changed files with 7,092 additions and 24 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci-make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,41 @@ jobs:
run: brew install nlohmann-json
if: matrix.runs-on == 'macos-latest'

- name: Run C++ tests
run: |
make tests
./tests
- name: Test makefile
run: make

- name: Test directly running main program
run: |
./main -p 4
./main -p 6 # Note: small population of 6 for quick runtime
ls -alth
- name: Test Python command line script
run: |
pip install numpy matplotlib
python run_main.py -R 1234 -p 6 --doEvol --folderName exampleRun2
python run_main.py -R 1233 -p 6 --doEvol --folderName exampleRun2 # Note: small population of 6 for quick runtime
- name: Test using OMV
- name: Test using OMV 1
run: |
pip install OSBModelValidation
omv all -V
git diff exampleRun/phenotype.dat
- name: Test using OMV 2
run: |
# Running OMV multiple times to test whether run results are nondeterministic
omv all -V
git diff exampleRun/phenotype.dat
- name: Test using OMV 3
run: |
# Running OMV multiple times to test whether run results are nondeterministic
omv all -V
git diff exampleRun/phenotype.dat
- name: list generated files
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
/nv2.dat
/phenotype2.dat
/w_verb.dat
/exampleRun/
/tests
2 changes: 1 addition & 1 deletion .test.example.omt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ experiments:
spike detection:
method: threshold
threshold: 2
tolerance: 0.4944500504540868
tolerance: 0
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ Muscles.o: Muscles.cpp Muscles.h VectorMatrix.h random.h
g++ -c -O3 -flto Muscles.cpp
main.o: main.cpp Worm.h WormBody.h StretchReceptor.h Muscles.h TSearch.h
g++ -c -O3 -flto main.cpp
tests.o: tests.cpp
g++ -c -O3 -flto tests.cpp
tests: tests.o
g++ -pthread -o tests tests.o
clean:
rm -f *.o main
rm -f *.o main tests
8 changes: 8 additions & 0 deletions Worm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ int nn(int neuronNumber, int unitNumber)
// The constructor
Worm::Worm(TVector<double> &v,double output)
{

// PG: Setting these to zero as they were not initialised before use!
// Note: the usage of these needs to be further investigated!
AVA_act = 0;
AVA_inact = 0;
AVB_act = 0;
AVB_inact = 0;

// Muscles
m.SetMuscleParams(N_muscles, T_muscle);

Expand Down
8 changes: 4 additions & 4 deletions Worm2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,12 @@ Params<double> getBodyParams(WormBody& b)
Params<double> par;

par.names = {"Medium", "L_worm", "R_min", "C_agar_par_total",
"C_agar_perp_total", "C_water_par_total", "C_water_perp_total", "kappa_L_fact", "kappa_D_fact",
"kappa_M0_fact", "beta_L_fact", "beta_D_fact", "beta_M0_fact", "delta_M"};
"C_agar_perp_total", "C_water_par_total", "C_water_perp_total", "kappa_L", "kappa_D",
"kappa_M0", "beta_L", "beta_D", "beta_M0", "delta_M"};

par.vals = {Medium, L_worm, R_min, C_agar_par_total, C_agar_perp_total,
C_water_par_total, C_water_perp_total, kappa_L_fact, kappa_D_fact, kappa_M0_fact, beta_L_fact,
beta_D_fact, beta_M0_fact, delta_M};
C_water_par_total, C_water_perp_total, kappa_L, kappa_D, kappa_M0, beta_L,
beta_D, beta_M0, delta_M};

par.messages_inds.resize(par.vals.size());

Expand Down
22 changes: 9 additions & 13 deletions WormBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,15 @@ const double C_agar_par_total = 3.2e-3; // Total tangenti
const double C_agar_perp_total = 128e-3; // Total rod normal drag coefficient in agar in kg/s
const double C_water_par_total = 3.3e-6; // Total rod tangential drag coefficient for water in kg/s
const double C_water_perp_total = 5.2e-6; // Total rod normal drag coefficient for water in kg/s
const double kappa_L_fact = (10.0e-3/24);
const double kappa_L = kappa_L_fact*N_segments;
const double kappa_D_fact = 350; // Lateral spring constant in kg/s
const double kappa_D = kappa_D_fact*kappa_L; // Diagonal spring constant in kg/s
const double kappa_M0_fact = 20;
const double kappa_M0 = kappa_M0_fact*kappa_L; // Baseline active muscle spring constant in kg/s
const double beta_L_fact = 0.25;
const double beta_L = beta_L_fact*kappa_L; // Lateral passive damping constant in s
const double beta_D_fact = 0.01;
const double beta_D = beta_D_fact*kappa_D; // Diagonal passive damping constant in s
const double beta_M0_fact = 100;
const double beta_M0 = beta_M0_fact*beta_L; // Baseline active damping constant in s
const double delta_M = 0.65; // Rest muscle length scaling constant

const double kappa_L = (10.0e-3*N_segments)/24; // Lateral spring constant in kg/s
const double kappa_D = 350*kappa_L; // Diagonal spring constant in kg/s
const double kappa_M0 = 20*kappa_L; // Baseline active muscle spring constant in kg/s
const double beta_L = 0.025*kappa_L; // Lateral passive damping constant in s
const double beta_D = 0.01*kappa_D; // Diagonal passive damping constant in s
const double beta_M0 = 100*beta_L; // Baseline active damping constant in s
const double delta_M = 0.65; // Rest muscle length scaling constant



// Derived constants
Expand Down
Binary file added exampleRun/ExampleActivity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4087ed9

Please sign in to comment.