#!/bin/sh

set -e

# initial run forward, a LP is detected
rauto cusp muf -UZR 2 -1

# initial run backward, a LP is detected
rauto cusp mub -DS -

# compute locus of folds
rrun=muf
rauto cusp LPf $rrun -IRS $(splabs $rrun LP 1 1) -ISW 2
rauto cusp LPb $rrun -IRS $(splabs $rrun LP 1 1) -ISW 2 -DS -

# initialise scan
rrun=muf
rauto cusp laf $rrun -IRS $(splabs $rrun UZ 1 1) -ICP 1 2 \
	-UZR 1 -2:0.1:2
rauto cusp lab $rrun -IRS $(splabs $rrun UZ 1 1) -ICP 1 2 \
	-UZR 1 -2:0.1:2 -DS -

# perform scan
rrun=laf
rauto cusp mu%02dff $rrun -IRS $(splabs $rrun UZ) -ICP 2 1
rauto cusp mu%02dfb $rrun -IRS $(splabs $rrun UZ) -ICP 2 1 -DS -
rrun=lab
rauto cusp mu%02dbf $rrun -IRS $(splabs $rrun UZ) -ICP 2 1
rauto cusp mu%02dbb $rrun -IRS $(splabs $rrun UZ) -ICP 2 1 -DS -

# show graphics
echo ""
echo "plot with:"
echo 'plotbd -i 1:4:3 "[-2:2]" "[-2:2]" `lsruns "mu*"` LPf LPb'
