Skip to content

Instantly share code, notes, and snippets.

@thespacedoctor
thespacedoctor / select-top-xmatches-from-marshall.sql
Created January 6, 2018 10:06
[Select the top rank sherlock xmatches from marshall] #xmatch #sherlock #pessto #marshall
SELECT
*
FROM
(SELECT
a.catalogue_table_id,
a.catalogue_table_name,
a.all_count,
COALESCE(top_rank_count, 0) AS `top_rank_count`
FROM
(SELECT
@thespacedoctor
thespacedoctor / README.md
Last active May 5, 2021 15:59
[Listen to GraceDB for new event maps] #gracedb #ligo_virgo #listen

Michael Coughlin's original script to listen to graceDB and download any new wave maps.

@thespacedoctor
thespacedoctor / april2016-march2017-pessto-stats-plots.py
Created January 8, 2018 13:18
[Plot Classification Stats for PESSTO from April 2016 - March 2017] #classification #pessto #stats #plot #histogram
#!/usr/local/bin/python
# encoding: utf-8
"""
april2016-march2017-pessto-stats-plots.py
=========================================
:Summary:
PESSTO Stat Plots
:Author:
David Young
@thespacedoctor
thespacedoctor / pessto-object-count-for-release-description.sql
Last active May 5, 2021 15:59
[List distinct objects PESSTO has taken spectra or imaging of] #phase_iii #eso #pessto #release_description #transient #efosc #sofi
-- FOR A SPECIFIC TYPE OF DATA (HERE EFOSC SPECTRA)
SELECT
*
FROM
(SELECT
COUNT(*) AS count, object, transientBucketId
FROM
(SELECT DISTINCT
object, transientBucketId
@thespacedoctor
thespacedoctor / spectra-coordinate-marshall-match-check.sql
Created January 8, 2018 20:36
[check for spectra where the coordinates in the FITS header do not match the marshall coordinates] #coordinate #phase_iii #spectrum
SELECT
e.currentFilename,
a.object,
a.ra,
a.decl,
e.ra,
e.decl,
raDeg,
decDeg,
e.transientBucketId,
@thespacedoctor
thespacedoctor / add-alternative-name-to-pessto-transients.sql
Created January 9, 2018 08:33
[Adding Alternative, Discovery and IAU Names for Phase III Transient Catalogue] #eso #phase_iii #transient #catalogue #pessto #identification
UPDATE phase_iii_transient_catalogue_ssdr3 p,
(SELECT
transientBucketId,
GROUP_CONCAT(name
SEPARATOR ', ') alternative_ids
FROM
(SELECT DISTINCT
t.TransientBucketId, t.name
FROM
transientBucket t, phase_iii_transient_catalogue_ssdr3 p
@thespacedoctor
thespacedoctor / README.md
Last active May 5, 2021 15:59
[Guide Star Catalogue bright stars crossmatched against ATLAS difference image detections] #gsc #atlas #star #bright_star #sherlock

A query was done to exact ATLAS (or was it PS1?) difference detections that are likely assoicated with bright stars from the local QUB ATLAS database. The query took all GSC stars brighter than V=16, crossmatched all difference detections within 5 arcmin and calculated the mean separation of this set of crossmatches in arcsec (see CSV file).

Plot the mean separation vs GSC magnitude reveals a distinction between the bright star cores found in the difference images (below black line) and the cruft resulting from poor image subtraction in the halos of these bright stars (abive the black line).

GSC bright star image subtraction issues

Here's another view of that data:

@thespacedoctor
thespacedoctor / README.md
Last active May 5, 2021 15:59
[Comparing galaxy size with brightness] #ned #galaxy #sherlock #magnitude #semi_major_axis

Taking a sample of 1,000,000 galaxies from NED and plotting semi-major axis measurements against magnitude:

From inspection it seems the lower limb in this plot is due to a bug in NED’s calculation of a homogenised semi-major axis measurement. The individual diameter measurements for a galaxy provide sensible measurement, but measurements reported on the galaxy’s synopsis page are far too large for objects in this sample.

@thespacedoctor
thespacedoctor / README.md
Last active May 5, 2021 15:59
[SQL Queries to Bulk Extract SDSS Catalogues] #sdss #sherlock #catalogue #star #galaxy #qso

These are the queries we use to extract out the relevant galaxy, star and QSO information we need from SDSS for our local QUB contextual classifier (Sherlock). These queries need to be re-ran and the data re-imported into our local database for each SDSS data-release.

@thespacedoctor
thespacedoctor / apache-test.py
Created January 20, 2018 19:53
[A python CGI script to test apache is working] #cgi #python #apache
#!/usr/local/bin/python
# encoding: utf-8
"""
test.py
========
:Summary:
A test script to test apache installs
:Author:
@thespacedoctor