Skip to content

Instantly share code, notes, and snippets.

@thespacedoctor
thespacedoctor / 01_README.md
Last active Apr 1, 2021
[Plot ESO 1D FITS Binary Table Spectra] #spectrum #eso
View 01_README.md

Plot ESO 1D FITS Binary Table Spectra

This script can be used to generate plots of spectra contained in the ESO Fits Binary Table format, and optionally include a visualisation of an associated 2D spectral image.

The gist containing this content and be found here.

Installation

conda create -n plot_spectrum python=3.7 pip six matplotlib specutils numpy colour ccdproc
@thespacedoctor
thespacedoctor / 0_REAME.md
Last active Apr 8, 2020
[Distribution of number of candidates that go into making ZTF objects] #ztf #lasair
View 0_REAME.md

Distribution of number of candidates that go into making ZTF objects

In ZTF speak a candidate is a single detection and an object is a collection of associated candidates. I wanted to visualise (see plot above) the distribution of the number of candidates (ncand) that go into making a ZTF object.

To generate the CANDIDATE table distribution data in candidate_ncand_dist.csv I run the following query on Lasair (April 8, 2020):

SELECT 
@thespacedoctor
thespacedoctor / ps1_point_source_scores_to_sherlock.py
Last active Mar 10, 2020
[PS1 to Sherlock Database Importer] #sherlock #panstarrts #dr1 #import
View ps1_point_source_scores_to_sherlock.py
#!/usr/bin/env python
# encoding: utf-8
"""
*Ingest FITS data downloaded from MAST into Sherlock Database*
:Author:
David Young
:Date Created:
January 9, 2020
@thespacedoctor
thespacedoctor / 0README.md
Last active Jan 8, 2020
[Whitelist Dropbox Folders to Sync] #dropbox #sync #whitelist
View 0README.md

Dropbox Whitelister

I use this script on my linux machines to whitelist a single folder located in my ~/Dropbox/server-sync directory. Here I have a separate folder for each of my servers.

To run the script use:

dropbox_whitelist [options] <serverName>

    -k|--keep       keep all byproduct files (use for debugging)
@thespacedoctor
thespacedoctor / 0README.md
Last active Mar 17, 2021
[Generate an SOF from directory of FITS files] #fits #sof #esorex
View 0README.md

Set of Frames (SOF) Files

Here's an example of sof (set of frames) files generated by the XSHooter pipeline when creating a master bias frame.

There are 4 files creates:

  1. data.sof
  2. input_sof.json
  3. output_files.sof
  4. products_sof.json
@thespacedoctor
thespacedoctor / 01_README.md
Last active Dec 7, 2019
[Parse Ligo-Virgo GCN VOEvents] #voevent #ligo_virgo #gcn
View 01_README.md

Parsing VOEvents Streamed from the Ligo-Virgo GCN Feed

Here you will find VOEvent packet examples for the 4 types of LV event alerts:

LV Alert Timeline<br>Image Credit: LVEM User Guide

  1. Preliminary GCN Notice. The automated preliminary notice is sent (via GCN) within 1-10 minutes of event detection and the trigger visible in GraceDB. Once a map has been generated a second preliminary notice is sent.

  2. Initial GCN Notices. A source classification (BNS, NSBH, BHBH ..) and updated skymap will be released within 4-24 hrs. The initial notice is also accompanied by a GCN Circular which is the first formal publication of the candidate and can be cited as such.

@thespacedoctor
thespacedoctor / example_recipe.py
Last active Nov 7, 2019
[Reflex Python Plugin Support] #python #reflex #pipeline #soxs #muse
View example_recipe.py
# This file shows the minimum example of a Python based EsoRex recipe that can
# be integrated into a EsoReflex workflow, i.e. executed with the RecipeExecuter
# actor.
# The appropriate module needs to first be loaded that provides the facilities
# for declaring an EsoRex recipe plugin.
import esorexplugin
# Additionally it is convenient to import some of the utility functions from the
# module directly into this code's namespace. Note, the import statement above
@thespacedoctor
thespacedoctor / README.md
Created Oct 22, 2019
[List a subset of keywords from all FITS frames in a specified directory] #fits #xshooter #soxs #keyword
View README.md

Report a list of the DPR.CATG, DPR.TECH and DPR.TYPE keywords from FITS frames.

Just copy the script into the directory of frames and run:

sh report_fits_keywords_for_directory.sh .
@thespacedoctor
thespacedoctor / download_kurucz_atoms.py
Last active Oct 9, 2019
[Kurucz Atomic Database Downloader] #atom #download #kurucz
View download_kurucz_atoms.py
#!/usr/local/bin/python
# encoding: utf-8
"""
*Scrape and download Kurucz atom lists*
:Author:
David Young
:Date Created:
October 8, 2019
@thespacedoctor
thespacedoctor / build_scheduler_api_calls_table.sql
Last active Oct 4, 2019
[Build Statistics Table for SOXS Scheduler API Calls] #soxs #scheduler #mysql
View build_scheduler_api_calls_table.sql
drop table scheduler_api_calls;
CREATE TABLE `scheduler_api_calls` (
`primaryId` bigint(20) NOT NULL AUTO_INCREMENT,
`transientBucketId` bigint(20) NOT NULL,
`objectName` varchar(50) NOT NULL,
`magnitude` double DEFAULT NULL,
`limitingMagnitude` tinyint(4) DEFAULT NULL,
`apiCallType` varchar(45) DEFAULT NULL,
`triggerTime` datetime NOT NULL,