Break out jupyter cells, now that it is possible

jupyter
Jeff Moe 2022-09-08 12:53:26 -06:00
parent 6e73e1d75b
commit 1d33022187
1 changed files with 154 additions and 28 deletions

View File

@ -193,27 +193,90 @@
},
"outputs": [],
"source": [
" pix_catalog = generate_star_catalog(fname)\n",
"\n",
" pix_catalog = generate_star_catalog(fname)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" print(colored(f\"Computing astrometric calibration for {fname}\", \"yellow\"))\n",
" solved = generate_reference_with_anet(fname, \"\", calfname)\n",
"\n",
" solved = generate_reference_with_anet(fname, \"\", calfname)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Generate star catalog\n",
" pix_catalog = pixel_catalog(f\"{fname}.cat\")\n",
" \n",
" pix_catalog = pixel_catalog(f\"{fname}.cat\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Calibrate from reference\n",
" calibrate_from_reference(fname, calfname, pix_catalog)\n",
"\n",
" calibrate_from_reference(fname, calfname, pix_catalog)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Store calibration\n",
" store_calibration(pix_catalog, f\"{fname}.cal\")\n",
"\n",
" store_calibration(pix_catalog, f\"{fname}.cal\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Read Fourframe\n",
" ff = FourFrame(fname)\n",
"\n",
" ff = FourFrame(fname)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Stars available and used\n",
" nused = np.sum(pix_catalog.flag == 1)\n",
" nstars = pix_catalog.nstars\n",
"\n",
" nstars = pix_catalog.nstars"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # 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",
@ -225,32 +288,77 @@
"\n",
" else:\n",
" color = \"red\"\n",
" print(colored(screenoutput, color))\n",
"\n",
" print(colored(screenoutput, color))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Generate predictions\n",
" predictions = ff.generate_satellite_predictions(cfg)\n",
"\n",
" predictions = ff.generate_satellite_predictions(cfg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Find tracks\n",
" if is_calibrated(ff):\n",
" tracks = ff.find_tracks_by_hough3d(cfg)\n",
"\n",
" else:\n",
" tracks = []\n",
"\n",
" tracks = []"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Identify tracks\n",
" satno = 90000\n",
" for t in tracks:\n",
" is_identified = t.identify(predictions, satno, \"22 500A\", None, cfg, abbrevs, tlefiles)\n",
" if not is_identified:\n",
" satno += 1\n",
"\n",
" satno += 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Format observations\n",
" obs = []\n",
" for t in tracks:\n",
" # Add to observation\n",
" obs.append(Observation(ff, t.tmid, t.x0, t.y0, ff.site_id,\n",
" t.satno, t.cospar, t.catalogname))\n",
"\n",
" t.satno, t.cospar, t.catalogname))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Write observations\n",
" for o in obs:\n",
" iod_line = o.to_iod_line()\n",
@ -269,12 +377,30 @@
" elif o.catalogname == \"unid\":\n",
" color = \"magenta\"\n",
"\n",
" print(colored(iod_line, color))\n",
"\n",
" print(colored(iod_line, color))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # Generate plots\n",
" # PNG image without lines overlaid\n",
" ff.diagnostic_plot(predictions, None, None, cfg)\n",
"\n",
" ff.diagnostic_plot(predictions, None, None, cfg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
" # PNG image for each track found\n",
" for track, o in zip(tracks, obs):\n",
" ff.diagnostic_plot(predictions, track, o, cfg)"