source: trunk/bin/asap @ 691

Last change on this file since 691 was 691, checked in by mar637, 19 years ago

bin/asap: add use of share directory, ipythonrc setup

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
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#
30# $Id: asap 691 2005-09-26 00:22:29Z mar637 $
31#---------------------------------------------------------------------------
32[ -x /usr/bin/clear ] && /usr/bin/clear
33
34echo "Loading ASAP..."
35
36prefix='/usr/local'
37
38# check if user set
39if [ "x${ASAPDATA}" == "x" ]; then
40    ASAPDATA="${prefix}/share/asap"
41    export ASAPDATA
42fi
43
44if [ ! -d "${ASAPDATA}" ]; then
45    echo "Couldn't locate the asap data directory"
46    #ASAPDATA="/nfs/aips++"
47    #export ASAPDATA
48    #exit 1
49fi
50
51# Keep casa measures happy
52if test -d "${ASAPDATA}/data" ; then
53    platform='Linux'
54    if [ `uname -s` == 'Darwin' ]; then
55        platform='darwin'
56    fi
57    AIPSPATH="${ASAPDATA} ${platform} somewhere localhost"
58    export AIPSPATH
59else
60    echo "Couldn't find the ASAP data directory"
61    exit 1
62fi
63
64# started for the first time
65ASAPUSERDIR="${HOME}/.asap"; export ASAPUSERDIR
66if [ ! -d ${ASAPUSERDIR} ]; then
67    echo 'First time ASAP use. Setting up ~/.asap'
68    mkdir "${ASAPUSERDIR}"
69    cp "${ASAPDATA}/ipythonrc-asap" "${ASAPUSERDIR}/"
70    echo "#Dummy placeholder. All info is in ipythonrc-asap" > "${ASAPUSERDIR}/ipythonrc"
71    touch "${ASAPUSERDIR}/asapuserfuncs.py"
72fi
73
74ip="`which ipython`"
75
76if [ ! -x "$ip" ]; then
77    echo "Can't find, or no execute permissions for 'ipython'"
78    echo "Running asap through 'python':"
79    p="`which python`"
80    $p -c 'from asap import *'
81else
82    $ip -ipythondir "${ASAPUSERDIR}" -p 'asap' $*
83fi
Note: See TracBrowser for help on using the repository browser.