Skip to content

Instantly share code, notes, and snippets.

View astropenguin's full-sized avatar

Akio Taniguchi astropenguin

View GitHub Profile
@astropenguin
astropenguin / nqm2ms
Last active February 13, 2023 05:31
nqm2ms: Convert NEWSTAR data (*.nqm) to CASA MS
#!/usr/bin/env python
"""nqm2ms: Convert NEWSTAR data (*.nqm) to CASA MS.
Usage: /path/to/casa -c nqm2ms [<nqm> [<nqm> ...]]
Note: This script only works with CASA <= 5.0.0.
"""
import asap
from random import randrange
from re import sub
from time import sleep
def update(lineno: int, pattern: str, repl: str) -> None:
"""Update part of this file by given pattern and replacement."""
with open(__file__, "r") as f:
lines = f.readlines()
@astropenguin
astropenguin / pipeline.py
Last active December 9, 2022 11:08
Pipeline and ancillary module for data reduction of NRO45m/ASTE position-switching data (*nqm) with CASA (<= 5.0.0)
# coding: utf-8
import sdpl
import numpy as np
import matplotlib.pyplot as plt
"""CASA pipeline for NRO45m/SAM45 PSW data.
This script uses the ATNF Spectral Analysis Package (ASAP),
moduled as `sd` in the Common Astronomy Software Packages (CASA).
# standard library
from dataclasses import dataclass
from typing import (
Any,
Callable,
Generic,
ParamSpec,
Protocol,
Type,
TypeVar,
@astropenguin
astropenguin / xarray-dataclasses-arraylike.ipynb
Last active March 5, 2022 10:30
xarray-dataclasses-arraylike.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astropenguin
astropenguin / xarray-dataclasses-pep646.ipynb
Created March 4, 2022 13:33
xarray-dataclasses-pep646.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astropenguin
astropenguin / casa_atm_model.ipynb
Last active February 7, 2022 09:17
casa_atm_model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
'''
makefmp.py - make frequency modulation pattern (FMP) file
+ developer: Akio Taniguchi (IoA, UTokyo)
+ contact: taniguchi_at_ioa.s.u-tokyo.ac.jp
'''
import sys
import socket
import time
from datetime import datetime
BUFSIZE = 4096
LOCAL_IP = "192.168.101.88"
MULTICAST_IP = "239.0.0.1"
MULTICAST_PORT = 6000
RECV_INTERVAL = 0.0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.