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

Author:
Andrew Miller <ak.miller@auckland.ac.nz>
Date:
2012-05-16 08:04:27+12:00
Desc:
Update figure axis labels
Permanent Source URI:
https://models.cellml.org/w/miller/uncertain-starting-parabola/rawfile/cdcc3e3537fc1019a1eea57f8edabef1032f0141/make-figures.sh

#!/bin/bash

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

export LIBRARY_PATH=$API_PATH
RS=$API_PATH/RunSEDML

export LD_LIBRARY_PATH=`dirname $RS`

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
postscript("fig1.eps", width=480, height=480, bg="white")
df1 <- read.csv('out1.csv')
plot(df1\$dg_pos_x, df1\$dg_pos_y, xlim=c(-2, 120), ylim=c(-450, 10), type='l',
     xlab='X Coordinate (m)', ylab='Y Coordinate (m)', 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()

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

postscript("fig3.eps", width=480, height=480, bg="white")
par(mfrow=c(2,2))
hist(dfsa\$dg_pos_initialx, breaks="fd", freq=FALSE, main='Initial x position', xlab='Initial x position (m)')
lines(density(dfsa\$dg_pos_initialx))

hist(dfsa\$dg_pos_initialy, main='Initial y position', breaks="fd", freq=FALSE, xlab='Initial y position (m)')
lines(density(dfsa\$dg_pos_initialy), main='Initial y position')

hist(dfsa\$dg_vel_initialx, main='Initial x velocity', breaks="fd", freq=FALSE, xlab='Initial x velocity (m/s)')
lines(density(dfsa\$dg_vel_initialx), main='Initial x velocity')

hist(dfsa\$dg_vel_initialy, main='Initial y velocity', breaks="fd", freq=FALSE, ylim=c(0,0.15), xlab='Initial y velocity (m/s)')
lines(density(dfsa\$dg_vel_initialy), main='Initial y velocity')
dev.off()
EOF