This is the pipeline that ingests and reduces new data from the lcogt key project
- Pipeline Documentation
- Installing the Pipeline and Database
- Testing your installation
- Appendix A: Expected output from show tables
- Appendix B: Installing 64 bit IRAF on Catalina
- Appendix C: Other packages you may need to install
- Appendix D: Installing Source Extractor
- Appendix E: Using the Pipeline with Docker
- Image Subtraction: https://www.authorea.com/users/75900/articles/96044-image-subtraction-with-lcogtsnpipe
- Manual (beta)
-
Install msql
- Install MySQL server from: https://dev.mysql.com/downloads/mysql/
Note: you don’t need an Oracle account to sign up, there is a just start download link at the bottom of the page. Links from here were very useful: https://dev.mysql.com/doc/refman/5.6/en/installing.html - Additional notes for Mac users: I used the DMG for OS X to install. This installs things in /usr/local. You can see if mysql is installed correctly by going to System Preferences. There should be mysql icon. Clicking on this you can start a mysql server
- Install MySQL server from: https://dev.mysql.com/downloads/mysql/
-
Set mysql to only throw a warning (rather than an error) when inserting or updating empty values into fields without default values:
mysql -uroot -p mysql> set session sql_mode = 'NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; mysql> set global sql_mode = 'NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; mysql> exit
-
Create database called Supernova
- download supernova database: https://www.dropbox.com/s/b28k5dkbs3i48nd/supernova_2020-01-31.sql?dl=0
- Connect to mysql as root:
mysql -u root -p
- Create the supernova database:
Expected output: Query OK, 1 row affected (0.01 sec)
mysql> CREATE DATABASE supernova;
- Create user supernova and grant privileges
Expected output: Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'supernova'@'localhost' IDENTIFIED BY 'supernova'; mysql> exit
- Create the supernova database and choose a password:
mysql -u root -p *your-password* < *database-including-path* e.g. mysql -u root -p zenith < /Users/valenti/Desktop/supernova_2020-01-31.sql
- Check that the database structure has been loaded
- Start mysql connecting to the supernova database as the supernova user and entering the password you just created
Enter password: *your-password*
mysql -u supernova -D supernova -p
- Check that the list of tables matches the list of tables matches the list in Appendix A
mysql> show tables; mysql> exit
- Start mysql connecting to the supernova database as the supernova user and entering the password you just created
-
Prepare your pipeline environment using Anaconda
- If you do not already have it, download anaconda for Python 3 (https://www.anaconda.com/distribution/)
- Add the astroconda channel to your conda search path:
conda config --add channels http://ssb.stsci.edu/astroconda
- Create a conda environment called lcogtsnpipe for the pipeline that uses Python 2.7
conda create -n lcogtsnpipe python=2.7
- Switch to your new lcogtsnpipe environment
conda activate lcogtsnpipe
- install astroconda (for details https://astroconda.readthedocs.io/en/latest/installation.html)
- If you are running mac OS <10.15 (catalina) then install with iraf:
conda install iraf-all pyraf-all stsci
- If you are running macOS >= 10.15 (catalina) then install without iraf and see Appendix B for 64bit IRAF installation instructions. Then:
conda install stsci
- If you are running mac OS <10.15 (catalina) then install with iraf:
- Install astroquery
conda install astroquery
- Install mysqldb
conda install MySQL-python
-
Install the pipeline
- Install git if you do not already have it (https://ucdavis.github.io/DS4S/#setup)
- Download the pipeline:
git clone https://github.com/svalenti/lcogtsnpipe
- Switch to the correct version of the pipeline
cd lcogtsnpipe git checkout exportpipe
- Install the pipeline:
cd trunk python setup.py install
-
Set up directory for data and configuration file
mkdir <your directory name> e.g. mkdir /Users/valenti/lco
-
Set LCOSNDIR environment variable either on the command line for a single session or in your .bashrc or .bash_profile file (this assumes you are using a bash shell) that points to where your data will live
export LCOSNDIR=<your directory name> e.g. export LCOSNDIR='/Users/valenti/lco'
-
Set LCOSNPIPE environment variable either on the command line for a single session or in your .bashrc or .bash_profile file (this assumes you are using a bash shell) that points to your lcogtsnpipe git repository
export LCOSNPIPE=<your directory name> e.g. export LCOSNPIPE='/Users/valenti/lco/lcogtsnpipe'
-
Create configuration file named configure in LCOSNDIR with the following lines:
hostname 127.0.0.1 database supernova mysqluser supernova mysqlpasswd *your-password* proposal [''] users [''] triggerpass '' extraobject [''] skipobjects ['auto_focus'] proposalingestion [''] ptfhost '' ptfdatabase '' ptfpasswd ''' ptfuser ''
Don't forget to fill in your password on the third line
-
Install vizquery: https://vizier.u-strasbg.fr/vizier/doc/cdsclient.html
Note: I had to sudo make install on my mac
- Download test data: https://www.dropbox.com/s/o3ls0zcqd64f49f/snexdata_2020-01-30_07%3A37%3A02.455163_23_6139.tar.gz?dl=0
- Add your test data to the Supernova database:
Note: if you run this more than once, it may delete your entry. Check that the photlco table has rows. If not, run a third time.
ingesttar.py -f snexdata_2020-01-30_07-37-02.455163_23_6139.tar
- Create a standard star catalog for apass and sdss catalog for AT2020oi field
Note: if you run this more than once, you may need to use the -F option to force the script to look again for a catalog
comparecatalogs.py
- Run cosmic ray rejection on the images:
lscloop.py -e 20200101-20200129 -s cosmic
- Generate a PSF model for images:
Where <path-to-your-conda> is the path to your anaconda installation
lscloop.py -e 20200101-20200130 -f apass --catalog=<path-to-your-conda>/envs/lcogtsnpipe/lib/python2.7/site-packages/lsc/standard/cat/apass/AT2020oi_apass.cat -s psf
- Calculate instrumental magnitudes with PSF photometry, displaying output in DS9
- Open DS9
ds9& lscloop.py -e 20200101-20200129 -s psfmag --show
- Find the zeropoint of the image:
Where <path-to-your-conda> is the path to your anaconda installation
lscloop.py -e 20200101-20200130 -f apass --catalog=<path-to-your-conda>/envs/lcogtsnpipe/lib/python2.7/site-packages/lsc/standard/cat/apass/AT2020oi_apass.cat -s zcat
- Find the apparent magnitude using zeropoint
Note: this step may give you a warning at the end: Error 1364: Field 'targetid' doesn't have a default value
lscloop.py -e 20200101-20200129 -s mag -F -f apass --type fit
- Check the magnitudes you just calculated by plotting them
lscloop.py -e 20200101-20200129 -s getmag --type mag --show
mysql> show tables;
+---------------------+
| Tables_in_supernova |
+---------------------+
| aseatide |
| atels |
| classifications |
| contention |
| datarequests |
| dbsyncs |
| eseatide |
| favorites |
| glade |
| glade_2 |
| groups |
| headerdefaults |
| hitslogger |
| iaunames |
| instruments |
| interests |
| lvc_galaxies |
| lvc_triggers |
| notes |
| obslog |
| obsrequests |
| obsrequests_tags |
| papers |
| permissionlog |
| phot_deprecated |
| photlco |
| photlcoraw |
| photpairing |
| programs |
| psns |
| reference_status |
| scheduling_run |
| schedulinglog |
| spec |
| speclcoguider |
| speclcoraw |
| tags |
| targetnames |
| targets |
| telescopes |
| timecharged |
| useractionlog |
| userrequests |
| users |
| voevent_amon |
| voevent_lvc |
| ztf_alerts |
| ztf_targets |
+---------------------+
48 rows in set (0.00 sec)
Liberally adopted from: https://iraf-community.github.io/install
- If you haven’t already, install Xcode compilers
xcode-select —install
- Set iraf environment variables (I don’t know if this is strictly necessary):
export TERM='xterm' export IRAFARCH='macintel' export OS_VERS='catalina'
- Disable System Integrity Protection
- Restart computer in recovery mode by holding down
command+R
during restart - From the Utilities menu select terminal
csrutil disable
- Restart computer in recovery mode by holding down
- Restart your computer
- Disable read-only access to your root directory
sudo mount -uw /
- Create iraf directory in /
sudo mkdir /iraf
- Download IRAF
sudo git clone https://github.com/iraf-community/iraf.git
- Install IRAF
- Install IRAF
set term to xterm
cd iraf sudo git checkout 567961f sudo ./install
- Add scripts install bin to path (this will be printed to the screen during the install process. For me it was ~/.iraf/bin
e.g. export PATH=‘/Users/bostroem/.iraf/bin':$PATH
- build iraf
sudo make macintel sudo make sysgen 2>&1 | tee build.log
- Edit the last line of
~/.iraf/setup.sh
replacingxgterm -e
withxterm
- Install Pyraf Make sure you are in your lcogtsnpipe environment (conda activate lcogtsnpipe) conda install pyraf
- Install IRAF
- Source Extractor:
- http://www.astromatic.net/software/sextractor Note: This was non-trivial on my Mac. See Appendix D for directions
- For difference image photometry:
- hotpants https://github.com/acbecker/hotpants
Note: There is a pull request submitted to this repo to fix issues with mac installation. I ended up cloning https://github.com/exowanderer/hotpants.git, checking out the remote - PyZOGY https://github.com/dguevel/PyZOGY
- hotpants https://github.com/acbecker/hotpants
In the directions below, is used repeatedly as a place holder for youractual username (e.g. bostroem)
- Install FFTW from source:
- Download: http://www.fftw.org/download.html
- Install:
./configure --prefix=/Users/<your username> make make install
- Install OpenBLAS from source:
- Download tar.gz file from link at top of page: https://www.openblas.net
- Install:
make PREFIX=/Users/<your username> install
- Install Source Extractor:
- Download: http://www.astromatic.net/software/sextractor
- Install:
Note: with these direction you do NOT need ATLASsh autogen.sh ./configure --with-fftw-incdir=/Users/<your username>/include --with-fftw-libdir=/Users/<your username>/lib --with-openblas-incdir=/Users/<your username/include --with-openblas-libdir=/Users/<your username>/lib --with-atlas-incdir=/Users/<your username>/include --with-atlas-libdir=/Users/<your username>/lib --enable-openblas make -j sudo make PREFIX=/Users/<your username> install
- Install vizquery:
- Download and follow installation directions: http://cdsarc.u-strasbg.fr/vizier/doc/cdsclient.html
You can also run the pipeline from within a Docker container. In the following instructions, the database server and image directories will live locally on your computer, so they will persist outside the Docker. The pipeline itself will run inside the Docker container and forward graphics to your local computer.
These instructions only need to be run once, when you set up the pipeline.
- Install MySQL. You'll set a root password that you'll need to remember later.
- Make sure to use Legacy Password Encryption. On Mac, this is System Preferences → MySQL → Initialize Database → Use Legacy Password Encryption.
- Also make sure MySQL is correctly added to your
PATH
.
- Install Docker.
- (MacOS only) Install XQuartz.
- (MacOS only) Install socat. If you have Homebrew installed, you can just run
brew install socat
. - Clone this repository:
git clone https://github.com/svalenti/lcogtsnpipe
- Initialize the database:
mysql -u root -p < lcogtsnpipe/supernova.sql
. You'll need to type the MySQL root password. - Build the Docker image:
docker build -t lcogtsnpipe lcogtsnpipe
- Create directories on your local machine (outside the Docker) where the images and data products will be stored:
mkdir /your/data/directory cd /your/data/directory mkdir lsc fts 0m4 floyds extdata apass sloan
Follow these instructions each time you want to use the pipeline.
- Make sure the MySQL server and Docker daemon are running.
- (MacOS only) Run XQuartz from the Finder.
- (MacOS only) Run this hack in the background to get the X11 forwarding to work:
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
- Run the Docker container:
docker run -it --rm -v /your/data/directory:/supernova/data lcogtsnpipe
. Replace/your/data/directory
with the directory you created above. - When you're done, type
exit
to leave the Docker.