Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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
Created December 27, 2017 13:29
[EFOSC SOFI Spectrum Counts for ESO Phase III] #phase_iii #efosc #sofi #spectrum #followup

How to Scrape the Data for the EFOSC SOFI Spectra for followed objects for ESO Phase III Release Description.

This will get you something like this:

Repeat this for SOFI spectra and export into an excel sheet and sort for the release description

@thespacedoctor
thespacedoctor / archive-stale-marshall-transients.sql
Created December 19, 2017 08:29
[Archive Stale Transients in Marshall] Archive Old Objects from the Marshall Inbox #marshall
-- To count the objects before you archive them:
select * from transientBucketSummaries t, pesstoObjects p where p.marshallWorkflowLocation = "inbox" and p.transientBucketId=t.transientBucketId and t.dateAdded < "2016-04-15";
-- and then to archive:
update transientBucketSummaries t, pesstoObjects p set p.marshallWorkflowLocation = "archive" where p.marshallWorkflowLocation = "inbox" and p.transientBucketId=t.transientBucketId and t.dateAdded < "2016-04-16";
@thespacedoctor
thespacedoctor / pinboard_tag_tidy_up.py
Created December 9, 2017 15:49
[Pinboard Tag Homogeniser] Make all pinboard tags lowercase with underscores #tag #pinboard
#!/usr/local/bin/python
# encoding: utf-8
"""
*Tidy up Pinboard Tags*
:Author:
David Young
:Date Created:
November 8, 2017
@thespacedoctor
thespacedoctor / tidy_gmail_labels.py
Last active May 5, 2021 15:59
[Tidy Gmail Labels] Homogenise the visibility and naming of my Gmail labels (later converterd to macos finder tags) #gmail #label #tag
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from apiclient import errors
try:
@thespacedoctor
thespacedoctor / 02a57844o0109c.dph
Last active May 5, 2021 15:59
[Find known astroids in ATLAS exposure] Using an inital pyephem generated ephemeris database, using orbfit, extract out the matched asteroid photometry from an ATLAS dophot file #atlas #asteroid #ephemeris #photometry
This file has been truncated, but you can view the full file.
# RA Dec m idx Type xtsk ytsk fitmag dfitmag sky major minor phi probgal apmag dapmag apsky ap-fit
72.99893 -0.17370 12.035 1 1 7313.40 41.15 -13.267 0.036 599.22 3.964 3.844 -11.84 -0.369E+02 -12.866 0.039 628.11 0.401
76.12737 -0.15137 12.590 2 1 1217.26 43.51 -12.759 0.020 537.91 4.137 3.937 -79.71 -0.294E+02 -12.990 0.007 583.07 -0.231
74.27340 -0.16706 12.081 4 1 4834.93 46.37 -13.238 0.028 607.48 3.996 3.876 -29.62 0.396E+02 99.999 0.011 0.00 0.000
76.61990 -0.13135 11.697 6 1 246.76 69.18 -13.643 0.018 504.47 4.218 3.926 -86.71 -0.306E+02 -13.908 0.003 581.17 -0.265
72.17332 -0.15140 11.307 8 1 8925.98 83.46 -13.998 0.016 662.68 3.941 3.859 7.13 0.320E+02 99.999 0.000 0.00 0.000
71.86221 -0.13694 11.915 14 1 9536.47 109.92 -13.374 0.011 648.81 3.940
@thespacedoctor
thespacedoctor / astorb2ephem.py
Last active May 5, 2021 15:59
[astorb2ephem] Convert the astorb.dat database into an ephemeris database for a given epoch #orbital_elements #astorb #pyephem #ephemeris
#!/usr/local/bin/python
# encoding: utf-8
"""
*Convert the astorb.dat database into an ephemeris database for a given epoch (a solar-system snapshot). Note this script uses PyEphem to generate the ephemerides, so although it is fast, the resulting ephemerides are far from accuracte*
:Author:
David Young
:Date Created:
October 6, 2017