jupyter lab minimally working with process_new

jupyter
Jeff Moe 2022-09-08 11:08:06 -06:00
parent 4dc8564d2a
commit f9d4ef808e
1 changed files with 34 additions and 54 deletions

View File

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