summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake_json_info_zzh.py54
-rwxr-xr-xmerge_imgdir_zzh.sh45
2 files changed, 0 insertions, 99 deletions
diff --git a/make_json_info_zzh.py b/make_json_info_zzh.py
deleted file mode 100755
index f4e4ad5..0000000
--- a/make_json_info_zzh.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Extract the source information and save as a JSON file for each
-# source of ZZH from the CSV collection file.
-#
-# Aaron LI
-# 2016-04-14
-#
-
-import os
-import re
-import sys
-import csv
-import json
-import functools
-from collections import OrderedDict
-
-argc = len(sys.argv)
-if argc < 2:
- print("usage:")
- print(" %s <input_csv> [ <output_json> <obs_id> ]" % \
- os.path.basename(sys.argv[0]))
- sys.exit(1)
-
-# extract default source name and obsid from the output path
-cwd = os.getcwd()
-m = re.match(r".*zzh/(?P<name>[^_]+)_oi(?P<obsid>\d+)/repro.*$", cwd)
-name = m.group("name")
-obsid = m.group("obsid")
-json_fn = name + "_INFO.json"
-
-csv_fn = sys.argv[1]
-if argc >= 3:
- json_fn = sys.argv[2]
-if argc == 4:
- obsid = int(sys.argv[3])
-
-with open(csv_fn, "r") as csvfile:
- csv_reader = csv.reader(csvfile)
- csv_data = list(csv_reader)
-
-csv_header = csv_data[0]
-obsid_colidx = functools.reduce(None,
- filter(lambda x: x[1] == "Obs. ID", enumerate(csv_header)))[0]
-csv_obsid = [ x[obsid_colidx] for x in csv_data ]
-obsid_dict = { obsid:idx for idx, obsid in enumerate(csv_obsid) }
-
-obsid_data = csv_data[obsid_dict["%s" % obsid]]
-json_data = OrderedDict(zip(csv_header, obsid_data))
-with open(json_fn, "w") as jsonfile:
- jsonfile.write(json.dumps(json_data, indent=4, ensure_ascii=False))
-
-# vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=python: #
diff --git a/merge_imgdir_zzh.sh b/merge_imgdir_zzh.sh
deleted file mode 100755
index 2cdb6d0..0000000
--- a/merge_imgdir_zzh.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-#
-# Clean and merge the two 'img' directories for ZZH's sample data.
-# * 'img': ${name}/${obsid}/evt2/img
-# * 'img2': ${name}/${obsid}/repro/img
-# The contents of 'img2' are merged to 'img'.
-#
-# Aaron LI
-# Created: 2016-04-26
-#
-
-IMG_DIR="img"
-IMG2_DIR="img2"
-
-case "$1" in
- -[hH]*)
- echo "Usage:"
- echo " `basename $0` <repro_dir1> ..."
- exit 1
- ;;
-esac
-
-INIT_DIR=`pwd -P`
-while [ ! -z "$1" ]; do
- repro_dir="$1"
- shift
- cd ${INIT_DIR}
- cd ${repro_dir}
- echo "*** ${PWD} ***"
- if [ ! -d "${IMG2_DIR}" ]; then
- echo "WARNING: '${IMG2_DIR}' does not exists; skipped!"
- continue
- fi
- # clean ${IMG_DIR} and ${IMG2_DIR}
- ( cd ${IMG_DIR}; \
- rm -fv _* *.log *bak evt2_*.fits img_*.fits \;
- rm -fv *smooth* *raw* \;
- rm -fv test* tmp* sources* pntsrc* )
- ( cd ${IMG2_DIR}; \
- rm -fv rspec* sbprofile* radius_sbp.txt flux_sbp.txt )
- # merge
- mv -fv ${IMG2_DIR}/* ${IMG_DIR}
- rmdir -v ${IMG2_DIR}
-done
-