Skip to content

Instantly share code, notes, and snippets.

View ijiraq's full-sized avatar

JJ Kavelaars ijiraq

View GitHub Profile
@ijiraq
ijiraq / args
Created May 14, 2015 19:41
How to add an argument that is boolean.
parser.add_argument("--fk", help="add the fk prefix on processing?",
default=False,
action='store_true')
args = parser.parse_args()
if args.fk:
# do something.
import struct
mpc_line = " ANONN01* C2013 11 01.30171 01 24 29.830+11 52 12.04 22.9 r 568"
mpc_format = '0s5s7s1s1s1s17s12s12s9x5s1s6x3s'
mpc_record = struct.unpack(mpc_format, mpc_line))
print mpc_record
def smoka_datarequest(frame_ids):
"""
Make a datarequest given a SMOKA frame id.
This is method is in here as an exmple for datalink service to follow.
:param frame_ids: list of frames to retrieve
:type frame_ids: list
:return: The content of the resulting POST to the smoka datarequest service.
"""
endpoint = """http://smoka.nao.ac.jp/datarequest"""
def get_suprimecam_mosaic_preview(frame_id="SUPA0010598X"):
"""
Retrieve a PNG mosiac preview from the SMOKA site
:param date:
:param frame_id:
:return:
"""
endpoint = "http://smoka.nao.ac.jp/qlis/ImagePNG"
frame_id = frame_id.replace("X", "0")
points = []
vertices = []
segment_type = SegmentType['MOVE']
for x, y in ([0, 0], [1, 0], [1, 1], [0, 1 ]):
V = w.all_pix2world(x*header['naxis1'], y*header['naxis2'], 1, 1, 1)
points.append(Point(float(V[0]), float(V[1])))
vertices.append(Vertex(float(V[0]), float(V[1]), segment_type))
segment_type = SegmentType['LINE']