[511] | 1 | #!/bin/sh
|
---|
| 2 | #--------------------------------------------------------------------------
|
---|
| 3 | # Wrapper script for ATNF Spectral Analysis Package (ASAP).
|
---|
| 4 | #---------------------------------------------------------------------------
|
---|
| 5 | # Copyright (C) 2004,2005
|
---|
| 6 | # ATNF
|
---|
| 7 | #
|
---|
| 8 | # This program is free software; you can redistribute it and/or modify it
|
---|
| 9 | # under the terms of the GNU General Public License as published by the Free
|
---|
| 10 | # Software Foundation; either version 2 of the License, or (at your option)
|
---|
| 11 | # any later version.
|
---|
| 12 | #
|
---|
| 13 | # This program is distributed in the hope that it will be useful, but
|
---|
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
---|
| 16 | # Public License for more details.
|
---|
| 17 | #
|
---|
| 18 | # You should have received a copy of the GNU General Public License along
|
---|
| 19 | # with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 20 | # 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
---|
| 21 | #
|
---|
| 22 | # Correspondence concerning this software should be addressed as follows:
|
---|
| 23 | # Internet email: Malte.Marquarding@csiro.au
|
---|
| 24 | # Postal address: Malte Marquarding,
|
---|
| 25 | # Australia Telescope National Facility,
|
---|
| 26 | # P.O. Box 76,
|
---|
| 27 | # Epping, NSW, 2121,
|
---|
| 28 | # AUSTRALIA
|
---|
| 29 | #
|
---|
[689] | 30 | # $Id: asap 731 2005-11-24 03:10:56Z mar637 $
|
---|
[511] | 31 | #---------------------------------------------------------------------------
|
---|
| 32 | [ -x /usr/bin/clear ] && /usr/bin/clear
|
---|
| 33 |
|
---|
| 34 | echo "Loading ASAP..."
|
---|
| 35 |
|
---|
[689] | 36 | prefix='/usr/local'
|
---|
[511] | 37 |
|
---|
[689] | 38 | # check if user set
|
---|
| 39 | if [ "x${ASAPDATA}" == "x" ]; then
|
---|
| 40 | ASAPDATA="${prefix}/share/asap"
|
---|
| 41 | export ASAPDATA
|
---|
[511] | 42 | fi
|
---|
| 43 |
|
---|
[689] | 44 | if [ ! -d "${ASAPDATA}" ]; then
|
---|
| 45 | echo "Couldn't locate the asap data directory"
|
---|
[731] | 46 | echo "Please set ASAPDATA"
|
---|
[691] | 47 | #ASAPDATA="/nfs/aips++"
|
---|
[689] | 48 | #export ASAPDATA
|
---|
| 49 | #exit 1
|
---|
| 50 | fi
|
---|
[636] | 51 |
|
---|
[689] | 52 | # Keep casa measures happy
|
---|
| 53 | if test -d "${ASAPDATA}/data" ; then
|
---|
[731] | 54 | platform='linux_gnu'
|
---|
[689] | 55 | if [ `uname -s` == 'Darwin' ]; then
|
---|
| 56 | platform='darwin'
|
---|
[550] | 57 | fi
|
---|
[691] | 58 | AIPSPATH="${ASAPDATA} ${platform} somewhere localhost"
|
---|
[689] | 59 | export AIPSPATH
|
---|
| 60 | else
|
---|
| 61 | echo "Couldn't find the ASAP data directory"
|
---|
| 62 | exit 1
|
---|
[545] | 63 | fi
|
---|
| 64 |
|
---|
[689] | 65 | # started for the first time
|
---|
[691] | 66 | ASAPUSERDIR="${HOME}/.asap"; export ASAPUSERDIR
|
---|
[689] | 67 | if [ ! -d ${ASAPUSERDIR} ]; then
|
---|
| 68 | echo 'First time ASAP use. Setting up ~/.asap'
|
---|
| 69 | mkdir "${ASAPUSERDIR}"
|
---|
[691] | 70 | cp "${ASAPDATA}/ipythonrc-asap" "${ASAPUSERDIR}/"
|
---|
| 71 | echo "#Dummy placeholder. All info is in ipythonrc-asap" > "${ASAPUSERDIR}/ipythonrc"
|
---|
[689] | 72 | touch "${ASAPUSERDIR}/asapuserfuncs.py"
|
---|
| 73 | fi
|
---|
[511] | 74 |
|
---|
[689] | 75 | ip="`which ipython`"
|
---|
| 76 |
|
---|
| 77 | if [ ! -x "$ip" ]; then
|
---|
| 78 | echo "Can't find, or no execute permissions for 'ipython'"
|
---|
| 79 | echo "Running asap through 'python':"
|
---|
| 80 | p="`which python`"
|
---|
| 81 | $p -c 'from asap import *'
|
---|
[691] | 82 | else
|
---|
[689] | 83 | $ip -ipythondir "${ASAPUSERDIR}" -p 'asap' $*
|
---|
| 84 | fi
|
---|