{ "cells": [ { "cell_type": "markdown", "id": "2602c814", "metadata": { "deletable": false, "editable": false }, "source": [ "# 4. Create reports \n", "\n", "This section introduces different ways to save query results:
\n", "\n", "- [4.1 - Export results as a table (alminer.save_table)](#4.1-Export-results-as-a-table)
\n", "- [4.2 - Save overview plots for each target (alminer.save_source_reports)](#4.2-Save-overview-plots)
\n", "\n" ] }, { "cell_type": "markdown", "id": "71d4a1e9", "metadata": { "deletable": false, "editable": false }, "source": [ "

Load libraries & create a query

\n", "\n", "To explore these options, we will first query the archive using one of the methods presented in the previous section and use the results in the remainder of this tutorial." ] }, { "cell_type": "code", "execution_count": 1, "id": "6bbeb579", "metadata": { "deletable": false, "editable": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "================================\n", "alminer.keysearch results \n", "================================\n", "--------------------------------\n", "Number of projects = 48\n", "Number of observations = 341\n", "Number of unique subbands = 1166\n", "Total number of subbands = 1368\n", "Total number of targets with ALMA data = 64\n", "--------------------------------\n" ] } ], "source": [ "import alminer\n", "\n", "observations = alminer.keysearch({'science_keyword':['\"Galaxy chemistry\"']}, \n", " print_targets=False)" ] }, { "cell_type": "markdown", "id": "6cb19e17", "metadata": { "deletable": false, "editable": false }, "source": [ "## 4.1 Export results as a table\n", "\n", "The [alminer.save_table](../pages/api.rst#alminer.save_table) function writes the provided DataFrame to a table in CSV format in the 'tables' folder within the current working directory. If the 'tables' folder does not exist, it will be created.\n" ] }, { "cell_type": "markdown", "id": "5a2eb993", "metadata": { "deletable": false, "editable": false }, "source": [ "### Example 4.1.1: save query results as a table" ] }, { "cell_type": "code", "execution_count": 2, "id": "7a81e2db", "metadata": { "deletable": false, "editable": false }, "outputs": [], "source": [ "alminer.save_table(observations, filename=\"galaxy_chemistry\")" ] }, { "cell_type": "markdown", "id": "38d3c157", "metadata": { "deletable": false, "editable": false }, "source": [ "## 4.2 Save overview plots\n", "\n", "The [alminer.save_source_reports](../pages/api.rst#alminer.save_source_reports) function creates overview plots of observed frequencies, angular resolution, LAS, frequency and velocity resolutions for each source in the provided DataFrame and saves them in PDF format in the 'reports' folder in the current working directory. If the 'reports' folder does not exist, it will be created. The reports are named after the target names. \n", "\n", "Note: Currently, the grouping is done based on ALMA target names, so the same source with a slighly different naming schemes will be treated as separate targets.\n" ] }, { "cell_type": "markdown", "id": "85fac2a3", "metadata": { "deletable": false, "editable": false }, "source": [ "### Example 4.2.1: save overview plots of each target with CO lines marked" ] }, { "cell_type": "markdown", "id": "79b34858", "metadata": { "deletable": false, "editable": false }, "source": [ "Let's first narrow down our large query to a smaller subset to only a range of frequencies (Band 3) and angular resolutions < 0.5\":" ] }, { "cell_type": "code", "execution_count": 3, "id": "82cd3288", "metadata": { "deletable": false, "editable": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--------------------------------\n", "Number of projects = 7\n", "Number of observations = 16\n", "Number of unique subbands = 61\n", "Total number of subbands = 61\n", "7 target(s) with ALMA data = ['NGC1266', 'Arp220', 'ngc6240', 'n613', 'NGC4418', 'NGC7469', 'Cloverleaf']\n", "--------------------------------\n" ] } ], "source": [ "selected = observations[(observations[\"min_freq_GHz\"] > 80.0) & \n", " (observations[\"max_freq_GHz\"] < 115.0) & \n", " (observations[\"ang_res_arcsec\"] < 0.5)]\n", "alminer.summary(selected)" ] }, { "cell_type": "markdown", "id": "321f0158", "metadata": { "deletable": false, "editable": false }, "source": [ "Now we can create and save plots for each source, with CO and its isotopologues marked:" ] }, { "cell_type": "code", "execution_count": 4, "id": "6d2037b8", "metadata": { "deletable": false, "editable": false }, "outputs": [], "source": [ "alminer.save_source_reports(selected, mark_CO=True)" ] } ], "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.9" }, "nbsphinx": { "execute": "never" } }, "nbformat": 4, "nbformat_minor": 5 }