Skip to content

Instantly share code, notes, and snippets.

View SpheMakh's full-sized avatar

Sphesihle Makhathini SpheMakh

View GitHub Profile
@SpheMakh
SpheMakh / itrf2enu.py
Last active January 18, 2016 10:05
itrf 2 enu
import numpy as np
from pyrap.tables import table
import pyrap.measures
def enu2itrf(xyz=None,casa_table=None,**kw):
if casa_table:
xyz = table(anttab).getcol("POSITION")
import pyrap.measures
dm = pyrap.measures.measures()
dq = pyrap.measures.dq
@SpheMakh
SpheMakh / pyxis-intro.py
Last active August 29, 2015 14:14
Intro to Pyxis
import Pyxis
# once Pyxis is loaded, ms,mqt, im, lsm, std,stefcal become available
import ms # ms module
import im # imager module
import mqt # meqtree-pipeliner wrap
import stefcal # self calibration module
from Pyxis.ModSupport import * # I will make a note whenever I use something from here
define("MS_REDO",True,"Remake MS if it already exists")
@SpheMakh
SpheMakh / pyxis-imaging.py
Created February 9, 2015 08:15
Pyxis script for imaging prac
## imaging Tut.
## update Pyxis if you haven't done so since 05 Feb 2015.
## Also ensure that you have lwimager installed
# run as $ pyxis msname image[options]
# options can be: cellsize,npix,gain,wprojplanes,column/data, etc
# to make a per N channel image add im.IMAGE_CHANNELIZE=N
# Find the MSs at jake:~makhathini/ratt/imaging
import Pyxis
import ms
@SpheMakh
SpheMakh / s3-sex2tigger.py
Created January 20, 2016 07:28
Convert s3-sex sky model to tigger LSM format
#!/usr/bin/env python
# Convert s3-sex catalog to tigger LSM format
# Usage: ./s3-sex2tigger.py <s3 catalog> <output name> [freq for fluxes]
# The frequency is optional. It uses 1400 by default
import os
import sys
import tempfile
s3model = sys.argv[1]
# the phase center PSF
self.phasePSF = phasePSF;
# Observed frequency
self.freq0 = freq0 or 1.;
# the compression in time
self.dtime = dtime or 1;
# the compression in frequency
self.dfreq = dfreq or 1;
# the resolution or the pixel size in radian
self.resolution = np.pi*(cellsize/3600.)/180.;
@SpheMakh
SpheMakh / Dockerfile
Created April 4, 2016 11:53
stimela-calibrator
FROM radioastro/meqtrees
MAINTAINER <sphemakh@gmail.com>
RUN mkdir -p /input /output # I/O directories
ADD src /code # source code that runs the given task
WORKDIR /code
CMD sh run.sh # execute task
emss_polar_beams.beam_symmetry = None
emss_polar_beams.filename_pattern = beam_$(hv).pat
emss_polar_beams.freq_labels = 1440,1442,1445,1447
emss_polar_beams.hier_interpol = 1
emss_polar_beams.horizon_masking = 0
emss_polar_beams.interpol_coord = lm
emss_polar_beams.l_beam_offset = 0.0
emss_polar_beams.m_beam_offset = 0.0
emss_polar_beams.normalization_factor = 1
emss_polar_beams.pattern_labels = a,b,c,d,e,f
calibrate_ifrs = all
critical_flag_threshold = 50
de_subset.source_subset = =dE
de_subset.subset_enabled = 1
do_output = CORR_RES
me.e_enable = 0
me.p_enable = 0
me.use_smearing = 0
ms_rfl.read_flagsets = -stefcal
ms_rfl.read_legacy_flags = 1
@SpheMakh
SpheMakh / predict_skylens.py
Last active April 25, 2017 12:34
Predict visibilities from a FITS image
import stimela
INPUT = 'input'
OUTPUT = 'output'
MSDIR = 'msdir'
MODEL = 'skylens.fits'
MS = 'test_predict_with_custom_fits.ms'
PREFIX = MS[:-3]
# import stimela package
import stimela
# Recipe I/O configuration
INPUT = "input-ska1mid" # This folder must exist
OUTPUT = "output-ska1mid"
MSDIR = "msdir-ska1mid"
PREFIX = "ska1mid-example" # Prefix for output images
# MS name