jupyter lab minimally working with process_new
parent
4dc8564d2a
commit
f9d4ef808e
|
@ -6,7 +6,6 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"#!/usr/bin/env python3\n",
|
|
||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import glob\n",
|
"import glob\n",
|
||||||
|
@ -101,11 +100,11 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
" conf_parser.add_argument(\"-c\",\n",
|
"# conf_parser.add_argument(\"-c\",\n",
|
||||||
" \"--conf_file\",\n",
|
"# \"--conf_file\",\n",
|
||||||
" help=\"Specify configuration file. If no file\" +\n",
|
"# help=\"Specify configuration file. If no file\" +\n",
|
||||||
" \" is specified 'configuration.ini' is used.\",\n",
|
"# \" is specified 'configuration.ini' is used.\",\n",
|
||||||
" metavar=\"FILE\")"
|
"# metavar=\"FILE\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -114,13 +113,13 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
" conf_parser.add_argument(\"-d\",\n",
|
"# conf_parser.add_argument(\"-d\",\n",
|
||||||
" \"--directory\",\n",
|
"# \"--directory\",\n",
|
||||||
" help=\"Specify directory of observations. If no\" +\n",
|
"# help=\"Specify directory of observations. If no\" +\n",
|
||||||
" \" directory is specified parent will be used.\",\n",
|
"# \" directory is specified parent will be used.\",\n",
|
||||||
" metavar=\"DIR\",\n",
|
"# metavar=\"DIR\",\n",
|
||||||
" dest=\"file_dir\",\n",
|
"# dest=\"file_dir\",\n",
|
||||||
" default=\".\")"
|
"# default=\".\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -148,7 +147,16 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
" conf_file=\"jupysat.ini\"\n",
|
" file_dir = (\"data/obs/jupyter/\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
" conf_file=\"config_jupyter.ini\"\n",
|
||||||
" result = cfg.read([conf_file])\n",
|
" result = cfg.read([conf_file])\n",
|
||||||
" if not result:\n",
|
" if not result:\n",
|
||||||
" print(\"Could not read config file: %s\\nExiting...\" % conf_file)\n",
|
" print(\"Could not read config file: %s\\nExiting...\" % conf_file)\n",
|
||||||
|
@ -194,8 +202,8 @@
|
||||||
" # Get files\n",
|
" # Get files\n",
|
||||||
"# fitsfnames = sorted(glob.glob(os.path.join(args.file_dir, \"2*.fits\")))\n",
|
"# fitsfnames = sorted(glob.glob(os.path.join(args.file_dir, \"2*.fits\")))\n",
|
||||||
"# procfnames = sorted(glob.glob(os.path.join(args.file_dir, \"2*.fits.png\"))) \n",
|
"# procfnames = sorted(glob.glob(os.path.join(args.file_dir, \"2*.fits.png\"))) \n",
|
||||||
" fitsfnames = [\"jupysat.fits\"]\n",
|
" fitsfnames = sorted(glob.glob(os.path.join(file_dir, \"jupyter.fits\")))\n",
|
||||||
" procfnames = sorted(glob.glob(os.path.join(\"2*.fits.png\")))\n",
|
" procfnames = sorted(glob.glob(os.path.join(file_dir, \"jupyter.fits.png\")))\n",
|
||||||
" fnames = [fname for fname in fitsfnames if f\"{fname}.png\" not in procfnames]"
|
" fnames = [fname for fname in fitsfnames if f\"{fname}.png\" not in procfnames]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -218,7 +226,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
" # Was this file already tried?\n",
|
" # Was this file already tried?\n",
|
||||||
" if not os.path.exists(f\"{fname}.cat\"):\n",
|
" if not os.path.exists(f\"{fname}.cat\"):\n",
|
||||||
"\n",
|
" print(\"fname === \", fname)\n",
|
||||||
" # Generate star catalog\n",
|
" # Generate star catalog\n",
|
||||||
" pix_catalog = generate_star_catalog(fname)\n",
|
" pix_catalog = generate_star_catalog(fname)\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -240,7 +248,7 @@
|
||||||
" break\n",
|
" break\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # Generate star catalog\n",
|
" # Generate star catalog\n",
|
||||||
" if not os.path.exists(f\"{fname}.cat\"):\n",
|
" if not os.path.exists(f\"{fname}.cat\"): \n",
|
||||||
" pix_catalog = generate_star_catalog(fname)\n",
|
" pix_catalog = generate_star_catalog(fname)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
|
@ -250,49 +258,21 @@
|
||||||
" calibrate_from_reference(fname, calfname, pix_catalog)\n",
|
" calibrate_from_reference(fname, calfname, pix_catalog)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # Store calibration\n",
|
" # Store calibration\n",
|
||||||
" store_calibration(pix_catalog, f\"{fname}.cal\")"
|
" store_calibration(pix_catalog, f\"{fname}.cal\")\n",
|
||||||
]
|
"\n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
" # Read Fourframe\n",
|
" # Read Fourframe\n",
|
||||||
" ff = FourFrame(fname)"
|
" ff = FourFrame(fname)\n",
|
||||||
]
|
"\n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
" # Stars available and used\n",
|
" # Stars available and used\n",
|
||||||
" nused = np.sum(pix_catalog.flag == 1)\n",
|
" nused = np.sum(pix_catalog.flag == 1)\n",
|
||||||
" nstars = pix_catalog.nstars"
|
" nstars = pix_catalog.nstars\n",
|
||||||
]
|
"\n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
" # Write output\n",
|
" # Write output\n",
|
||||||
" screenoutput = \"%s %10.6f %10.6f %4d/%4d %5.1f %5.1f %6.2f +- %6.2f\" % (\n",
|
" screenoutput = \"%s %10.6f %10.6f %4d/%4d %5.1f %5.1f %6.2f +- %6.2f\" % (\n",
|
||||||
" os.path.basename(ff.fname), ff.crval[0], ff.crval[1], nused, nstars,\n",
|
" os.path.basename(ff.fname), ff.crval[0], ff.crval[1], nused, nstars,\n",
|
||||||
" 3600.0 * ff.crres[0], 3600.0 * ff.crres[1], np.mean(\n",
|
" 3600.0 * ff.crres[0], 3600.0 * ff.crres[1], np.mean(\n",
|
||||||
" ff.zavg), np.std(ff.zavg))"
|
" ff.zavg), np.std(ff.zavg))\n",
|
||||||
]
|
"\n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
" if is_calibrated(ff):\n",
|
" if is_calibrated(ff):\n",
|
||||||
" color = \"green\"\n",
|
" color = \"green\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
Loading…
Reference in New Issue