*** WORK IN PROGRESS ***
Index:
- Requirements
- Data sources
- Installing SID
- Installing DIF
- Installing MCS
- Installing custom UDFs
- PHP demo program – importing VOTables
- Python demo programs
- C demo programs
- Julia demo programs – importing FITS tables
- C++ demo programs – TODO
- Fortran77 demo programs – TODO
- IDL demo programs – plotting HEALPix sky maps
- AMP + JavaScript – DB web interface
- Troubleshooting – TODO
- DB words
Note: We assume that you have created a working directory, e.g. mpe2018, in your $HOME
shell> cd shell> mkdir mpe2018 shell> cd mpe2018
and downloaded (or will download when requested) the course files with a directory structure like this:
mpe2018 | soft_dirs.tar.gz |-- Data |-- Docs |-- Web `-- Soft `-- C | |-- UDFs | `-- dbIO | |-- C++ |-- F77 | `-- mcs_fdemos | |-- IDL |-- Julia |-- PHP |-- Python `-- SQL
For convenience, the tar file soft_dirs.tar.gz contains the whole Soft tree structure.
Download it in the ~/mpe2018 directory (or another you prefer) and untar it:
shell> cd ~/mpe2018 shell> wget https://ross2.oas.inaf.it/imprs-db/soft_dirs.tar.gz shell> tar zxvf soft_dirs.tar.gz
To download the whole Data directory, see the instructions in the reference page.
Some of these files will be overwritten during the course, so verify your local version matches that on the website.
Commands are to be executed in a terminal either at the shell prompt or the MySQL prompt. When there could be ambiguity, the shell> or mysql> prompt is shown explicitly.
Examples:
cd ~/mpe2018/Data curl -o cx_out.xml --form coordFormat=decimal --form outputFormat=vot --form query='SELECT TOP 50 m.name, m.ra, m.dec, m.significance, m.flux_aper_b, m.alpha FROM master_source m WHERE (m.significance > 10.0 AND m.pileup_flag = 0)' 'https://cda.cfa.harvard.edu/csccli/getProperties' curl -o cx_out.txt --form coordFormat=decimal --form query=@csc_query.sql 'https://cda.cfa.harvard.edu/csccli/getProperties'
And this is the content of csc_query.sql:
SELECT DISTINCT m.name, m.ra, m.dec, m.extent_flag, m.err_ellipse_r0, m.err_ellipse_r1, m.conf_flag, m.flux_aper_b, m.flux_aper_w, m.significance FROM master_source m WHERE (m.significance > 10.0 AND m.pileup_flag = 0)
You can substitute the previous query for example with this and rerun:
SELECT DISTINCT TOP 1000 m.name, m.ra, m.dec, m.err_ellipse_r0, m.conf_flag, m.sat_src_flag, m.significance, m.flux_aper_b, m.flux_aper_w FROM master_source m WHERE (m.significance > 10.0 AND m.pileup_flag = 0) ORDER BY name ASC
Note how we used vot for the output file. This refers to the VOTable format. It will be used transparently in some examples, but if you want to know about it, have a look to the reference document.
Python demo programs
You need to install the MySQLdb package (but other options exist). E.g. on Linux Debian/Ubuntu:
sudo apt install python-mysqldb
See the demo page.
PHP demo programs
To communicate with the database we use the MySQLi Extension. Please see the demo programs source code and refer to the mysqli manual pages.
See the demo page.
Julia demo programs
You need to have Julia installed. Please refer to the Julia web site.
IDL and Fortran demo programs
You need to have MCS installed. Please refer to this page.
See the demo page.