HSC data analysis pipeline
=================================================
This is a binary package of the HSC data analysis pipeline provided for
general observers at Subaru Telescope. This package contains many pieces of
free software and open-source software authored by various communities.
The central part of the pipeline (hscPipe and LSST stack) is distributed
under GPLv3.


Table of contents
-------------------------------------------------
  * Install
  * Use with PBS (Torque)
  * Start analysis

Install
-------------------------------------------------

### Install in /opt

```
[user@localhost ~]$ cd /opt
[user@localhost opt]$ tar -xJvf {path-to-the-tarball}
```

That's all.


### Install elsewhere
If you have extracted the tarball in a directory different from /opt
(in other words, if this file is not named /opt/hscpipe/{version}/README.md )
then you have to run install.sh. Thus:

```
[user@localhost folder]$ ./install.sh
```

This process takes a few minute.

Use with PBS (Torque)
-------------------------------------------------
(Only) if you are to use the pipeline with PBS, you have to re-compile mpich2
in an environment where PBS exists.
After installing the pipeline in the usual way, run

```
[user@localhost folder]$ source /opt/hscpipe/{version}/bashrc
# If you have installed this binary in a place different from /opt,
# change the above file path accordingly.

[user@localhost folder]$ setup-hscpipe
[user@localhost folder]$ bash $LSST_HOME/../recompile-mpich.sh /opt/pbs
```

(Modify `/opt/pbs` for your environment)

Start analysis
-------------------------------------------------
For the pipeline to work, environment variables must be set beforehand.
Though you may as well source
`/opt/hscpipe/{version}/lsst_home/loadLSST.bash` , we recommend
beginners should source `/opt/hscpipe/{version}/bashrc` instead because
a function introduced by the latter checks the validity of the installation
before setting up environment variables. Thus:

```
[user@localhost folder]$ source /opt/hscpipe/{version}/bashrc
# If you have installed this binary in a place different from /opt,
# change the above file path accordingly.

[user@localhost folder]$ setup-hscpipe
```

`bashrc` in this binary package will not modify environment variables
until you type `setup-hscpipe` . So it is probably safe to add the statement
`source /opt/hscpipe/{version}/bashrc` to your `$HOME/bashrc` .
We do not recommend further adding the statement `setup-hscpipe` to
`$HOME/bashrc` since it would change the environment all too radically for
an initial state on login. It means you should at least type `setup-hscpipe`
every time you log in before using this pipeline.

To start analysis, you have to prepare a work directory (called
"root" directory). A few files have to be there before starting to use it.
The script `create-rootdir.sh` will perform the preparation for you, though
you can do it yourself.

```
[user@localhost folder]$ setup-hscpipe
[user@localhost folder]$ create-rootdir.sh ROOTDIR REFDIR YSTRAYLIGHTDIR
```

ROOTDIR is the path to a work directory.
REFDIR is the path to the directory of a reference catalog.
YSTRAYLIGHTDIR is the path to the directory of y-band stray light.
