Location: Uncertain starting point parabola @ d21b867931ee / make-figures.sh

Author:
Andrew Miller <ak.miller@auckland.ac.nz>
Date:
2011-08-16 15:59:08+12:00
Desc:
Add a sensitivity analysis SED-ML, and get the script to generate figures to use it.
Permanent Source URI:
https://models.physiomeproject.org/w/miller/uncertain-starting-parabola/rawfile/d21b867931ee7a475d53dd0eb2af3fb518584d4f/make-figures.sh

#!/bin/bash

API_PATH=~/code/cellml-api
if [[ ! -d $API_PATH ]]; then
  API=~/Documents/cellml-api
fi

export LIBRARY_PATH=$API
RS=$API/RunSEDML

for i in `seq 1 10`; do
  $RS file://`pwd`/single-run.sedml | tail -n+2 >out$i.csv;
done

$RS file://`pwd`/sens-analysis.sedml |grep -v "Task finished successfully" > out-sa.csv

R --no-save <<EOF
png("fig1.png", width=480, height=480, bg="white")
df1 <- read.csv('out1.csv')
plot(df1\$dg_pos_x, df1\$dg_pos_y, xlim=c(-10, 120), ylim=c(-450, 10), type='l',
     xlab='X Co-ordinate', ylab='Y Co-ordinate', main='Sampled outcomes of parabolic motion model\nwith uncertain initial position and velocity')
for (i in 2:10) {
  dfi <- read.csv(sprintf('out%d.csv', i))
  lines(dfi\$dg_pos_x, dfi\$dg_pos_y)
  dfi <- NULL
}
df1 <- NULL
dev.off()

png("fig2.png", width=480, height=480, bg="white")
dfsa <- read.csv('out-sa.csv')
plot(dfsa\$dg_pos_x, dfsa\$dg_pos_y,
     xlab='Final X', ylab='Final Y', main='Sensitivity analysis of final position in parabolic motion model\nwith uncertain initial position and velocity')
dev.off()
EOF