| 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 1434 2008-08-28 03:55:49Z MalteMarquarding $ | 
|---|
| 31 | #--------------------------------------------------------------------------- | 
|---|
| 32 | [ -x /usr/bin/clear ] && /usr/bin/clear | 
|---|
| 33 |  | 
|---|
| 34 | # do not remove this line it gets replaced on install with custom moduledir | 
|---|
| 35 | # **PYTHONPATH** | 
|---|
| 36 |  | 
|---|
| 37 | echo "Loading ASAP..." | 
|---|
| 38 |  | 
|---|
| 39 | ip="`which ipython`" | 
|---|
| 40 | p="`which python`" | 
|---|
| 41 |  | 
|---|
| 42 | # no ipython installation - run without all the goodies | 
|---|
| 43 | if [ ! -x "$ip" ]; then | 
|---|
| 44 | echo "Can't find, or no execute permissions for 'ipython'" | 
|---|
| 45 | echo "Running asap through 'python':" | 
|---|
| 46 | $p -c 'from asap import *' | 
|---|
| 47 | else | 
|---|
| 48 | # if run for the first time set-up ipythonrc profile and ~/.asap | 
|---|
| 49 | if [ ! -d "${HOME}/.asap" ]; then | 
|---|
| 50 | $p -c "import asap" | 
|---|
| 51 | fi | 
|---|
| 52 | # now execute ipython using the profile | 
|---|
| 53 | $ip -ipythondir "${HOME}/.asap" $* | 
|---|
| 54 | fi | 
|---|