Update documentation

This commit is contained in:
Allen Downey
2020-11-16 10:18:37 -05:00
parent f4982019a3
commit f1a11932ea
15 changed files with 251 additions and 201 deletions
-25
View File
@@ -243,11 +243,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#selecting-a-region">
Selecting a region
@@ -323,26 +318,6 @@
<li><p>Download the results of a query and store them in a file.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="selecting-a-region">
<h2>Selecting a region<a class="headerlink" href="#selecting-a-region" title="Permalink to this headline"></a></h2>
<p>One of the most common ways to restrict a query is to select stars in a particular region of the sky.</p>
-25
View File
@@ -243,11 +243,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#reload-the-data">
Reload the data
@@ -340,26 +335,6 @@
<li><p>Save a <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code> in an HDF5 file.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia python-wget
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="reload-the-data">
<h2>Reload the data<a class="headerlink" href="#reload-the-data" title="Permalink to this headline"></a></h2>
<p>In the previous lesson, we ran a query on the Gaia server and downloaded data for roughly 100,000 stars. We saved the data in a FITS file so that now, picking up where we left off, we can read the data from a local file rather than running the query again.</p>
-25
View File
@@ -243,11 +243,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#reload-the-data">
Reload the data
@@ -326,26 +321,6 @@
<li><p>Write an ADQL query that selects based on proper motion.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia python-wget
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="reload-the-data">
<h2>Reload the data<a class="headerlink" href="#reload-the-data" title="Permalink to this headline"></a></h2>
<p>The following cells download the data from the previous lesson, if necessary, and load it into a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p>
-25
View File
@@ -243,11 +243,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#reloading-the-data">
Reloading the data
@@ -326,26 +321,6 @@
<li><p>Write ADQL queries involving <code class="docutils literal notranslate"><span class="pre">JOIN</span></code> operations.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia python-wget
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="reloading-the-data">
<h2>Reloading the data<a class="headerlink" href="#reloading-the-data" title="Permalink to this headline"></a></h2>
<p>The following cell downloads the data from the previous notebook.</p>
-25
View File
@@ -243,11 +243,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#reload-the-data">
Reload the data
@@ -342,26 +337,6 @@
<li><p>Use Pandas to merge data from multiple <code class="docutils literal notranslate"><span class="pre">DataFrames</span></code>, much like a database <code class="docutils literal notranslate"><span class="pre">JOIN</span></code> operation.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia python-wget
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="reload-the-data">
<h2>Reload the data<a class="headerlink" href="#reload-the-data" title="Permalink to this headline"></a></h2>
<p>The following cell downloads the photometry data we created in the previous notebook.</p>
-25
View File
@@ -242,11 +242,6 @@
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#installing-libraries">
Installing libraries
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#making-figures-that-tell-a-story">
Making Figures That Tell a Story
@@ -354,26 +349,6 @@
<li><p>Generate a figure with multiple subplots.</p></li>
</ul>
</div>
<div class="section" id="installing-libraries">
<h2>Installing libraries<a class="headerlink" href="#installing-libraries" title="Permalink to this headline"></a></h2>
<p>If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries well use.</p>
<p>If you are running this notebook on your own computer, you might have to install these libraries yourself.</p>
<p>If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.</p>
<p>TODO: Add a link to the instructions.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># If we&#39;re running on Colab, install libraries</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">IN_COLAB</span> <span class="o">=</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span>
<span class="k">if</span> <span class="n">IN_COLAB</span><span class="p">:</span>
<span class="o">!</span>pip install astroquery astro-gala pyia python-wget
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="making-figures-that-tell-a-story">
<h2>Making Figures That Tell a Story<a class="headerlink" href="#making-figures-that-tell-a-story" title="Permalink to this headline"></a></h2>
<p>So far the figure weve made have been “quick and dirty”. Mostly we have used Matplotlibs default style, although we have adjusted a few parameters, like <code class="docutils literal notranslate"><span class="pre">markersize</span></code> and <code class="docutils literal notranslate"><span class="pre">alpha</span></code>, to improve legibility.</p>
+70 -1
View File
@@ -318,7 +318,76 @@ aware that these versions might diverge in the future.</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb"><img src="run_on_colab_small.png"></a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb">or click here to read it on NBViewer</a></p>
<p><strong>Installation instructions</strong></p>
<p>Coming soon.</p>
<p>If you plan to run these notebooks on Colab, you dont have to install anything; you can use the links in the
previous section to open and run them.
If you want to run the notebooks in your own environment, you might have to do some setup.</p>
<p>You will need to install Python, Jupyter, and some additional libraries.
If you dont already have Jupyter, we recommend installing Anaconda, which is a Python distribution that
contains everything you need to run the workshop code. It is easy to install on Windows, Mac, and Linux,
and because it does a user-level install, it will not interfere with other Python installations.</p>
<p><a class="reference external" href="https://www.anaconda.com/distribution/">Information about installing Anaconda is here</a>.</p>
<p>If you have the choice of Python 2 or 3, choose Python 3.</p>
<p>Now, there are two ways to get the libraries you need:</p>
<ul class="simple">
<li><p>Option 1: You can install them in an existing Conda environment.</p></li>
<li><p>Option 2: You can create a new Conda environment.</p></li>
</ul>
<p>Installing libraries in an existing environment is simpler, but if you use the same environment for many projects, it will get big, complicated, and prone to package conflicts.</p>
<p><strong>Option 1:</strong> <em>Installing libraries in an existing Conda environment</em></p>
<p>Most of the libraries we need can be installed using Conda, by running the following commands in a Terminal.
If you are on a Mac or Linux machine, you should be able to use any Terminal.<br />
If you are on Windows, you might have to use the Anaconda Prompt, which you can find under the Start menu.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="n">jupyter</span> <span class="n">numpy</span> <span class="n">scipy</span> <span class="n">pandas</span> <span class="n">matplotlib</span> <span class="n">seaborn</span> <span class="n">libopenblas</span>
<span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">c</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> <span class="n">astropy</span> <span class="n">astroquery</span> <span class="n">astro</span><span class="o">-</span><span class="n">gala</span> <span class="n">python</span><span class="o">-</span><span class="n">wget</span>
</pre></div>
</div>
<p>In addition, theres one library we cant install with Conda, so we have to use <code class="docutils literal notranslate"><span class="pre">pip</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">pyia</span>
</pre></div>
</div>
<p><strong>Option 2:</strong> <em>Creating a new Conda environment</em></p>
<p>To create a new Conda environment, youll need to download an environment file from our repository. On Mac or Linux, you can download it using <code class="docutils literal notranslate"><span class="pre">wget</span></code> on the command line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">wget</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">raw</span><span class="o">.</span><span class="n">githubusercontent</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">AllenDowney</span><span class="o">/</span><span class="n">AstronomicalData</span><span class="o">/</span><span class="n">main</span><span class="o">/</span><span class="n">environment</span><span class="o">.</span><span class="n">yml</span>
</pre></div>
</div>
<p>Or you can <a class="reference external" href="https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/environment.yml">download it using this link</a>.</p>
<p>In a Terminal or Jupyter Prompt, make sure you are in folder where <code class="docutils literal notranslate"><span class="pre">environment.yml</span></code> is stored, and run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">env</span> <span class="n">create</span> <span class="o">-</span><span class="n">f</span> <span class="n">environment</span><span class="o">.</span><span class="n">yml</span>
</pre></div>
</div>
<p>Then, to activate the environment you just created, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">activate</span> <span class="n">AstronomicalData</span>
</pre></div>
</div>
<p><strong>Run Jupyter</strong></p>
<p>If you are not familiar with Jupyter, you can <a class="reference external" href="https://jupyter.org/try">run a tutorial by clicking here</a>.
Then select “Try Classic Notebook”. It will open a notebook with instructions for getting started.
Or you can run this <a class="reference external" href="https://colab.research.google.com/notebooks/intro.ipynb">introductory notebook on Colab</a>.</p>
<p>Before you launch Jupyter, <a class="reference external" href="https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/test_setup.ipynb">download this notebook</a>, which contains code to test your environment.</p>
<p>Or you can use <code class="docutils literal notranslate"><span class="pre">wget</span></code> to download it on the command line, like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">wget</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">raw</span><span class="o">.</span><span class="n">githubusercontent</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">AllenDowney</span><span class="o">/</span><span class="n">AstronomicalData</span><span class="o">/</span><span class="n">main</span><span class="o">/</span><span class="n">test_setup</span><span class="o">.</span><span class="n">ipynb</span>
</pre></div>
</div>
<p>To start Jupyter, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">jupyter</span> <span class="n">notebook</span>
</pre></div>
</div>
<p>Jupyter should launch your default browser or open a tab in an existing browser window.
If not, the Jupyter server should print a URL you can use. For example, when I launch Jupyter, I get</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ jupyter notebook
[I 10:03:20.115 NotebookApp] Serving notebooks from local directory: /home/username
[I 10:03:20.115 NotebookApp] 0 active kernels
[I 10:03:20.115 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 10:03:20.115 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
</pre></div>
</div>
<p>In this case, the URL is <a class="reference external" href="http://localhost:8888">http://localhost:8888</a>.<br />
When you start your server, you might get a different URL.
Whatever it is, if you paste it into a browser, you should should see a home page with a list of directories.</p>
<p>Now open the notebook you downloaded and run the cells that contain <code class="docutils literal notranslate"><span class="pre">import</span></code> statements.
If they work and you get no error messages, <strong>you are all set</strong>.</p>
<p>If you get error messages about missing packages, you can install the packages you need using Conda or <code class="docutils literal notranslate"><span class="pre">pip</span></code>.</p>
<p>If you run into problems with these instructions, let us know and we will make corrections. Good luck!</p>
<div class="toctree-wrapper compound">
</div>
</div>
+13 -8
View File
@@ -46,23 +46,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions.\n"
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1949,6 +1953,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+13 -8
View File
@@ -50,23 +50,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions.\n"
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1877,6 +1881,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+13 -8
View File
@@ -42,23 +42,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions.\n"
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1430,6 +1434,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+13 -8
View File
@@ -42,23 +42,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions."
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1298,6 +1302,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+13 -8
View File
@@ -44,23 +44,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions."
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1349,6 +1353,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+13 -8
View File
@@ -40,23 +40,27 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"## Installing libraries\n",
"\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and a the other libraries we'll use.\n",
"If you are running this notebook on Colab, you can run the following cell to install Astroquery and the other libraries we'll use.\n",
"\n",
"If you are running this notebook on your own computer, you might have to install these libraries yourself. \n",
"\n",
"If you are using this notebook as part of a Carpentries workshop, you should have received setup instructions.\n",
"\n",
"TODO: Add a link to the instructions."
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# If we're running on Colab, install libraries\n",
@@ -1163,6 +1167,7 @@
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
+102 -1
View File
@@ -169,4 +169,105 @@ Press this button to run this notebook on Colab:
**Installation instructions**
Coming soon.
If you plan to run these notebooks on Colab, you don't have to install anything; you can use the links in the
previous section to open and run them.
If you want to run the notebooks in your own environment, you might have to do some setup.
You will need to install Python, Jupyter, and some additional libraries.
If you don't already have Jupyter, we recommend installing Anaconda, which is a Python distribution that
contains everything you need to run the workshop code. It is easy to install on Windows, Mac, and Linux,
and because it does a user-level install, it will not interfere with other Python installations.
[Information about installing Anaconda is here](https://www.anaconda.com/distribution/).
If you have the choice of Python 2 or 3, choose Python 3.
Now, there are two ways to get the libraries you need:
* Option 1: You can install them in an existing Conda environment.
* Option 2: You can create a new Conda environment.
Installing libraries in an existing environment is simpler, but if you use the same environment for many projects, it will get big, complicated, and prone to package conflicts.
**Option 1:** *Installing libraries in an existing Conda environment*
Most of the libraries we need can be installed using Conda, by running the following commands in a Terminal.
If you are on a Mac or Linux machine, you should be able to use any Terminal.
If you are on Windows, you might have to use the Anaconda Prompt, which you can find under the Start menu.
```
conda install jupyter numpy scipy pandas matplotlib seaborn libopenblas
conda install -c conda-forge astropy astroquery astro-gala python-wget
```
In addition, there's one library we can't install with Conda, so we have to use `pip`:
```
pip install pyia
```
**Option 2:** *Creating a new Conda environment*
To create a new Conda environment, you'll need to download an environment file from our repository. On Mac or Linux, you can download it using `wget` on the command line:
```
wget https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/environment.yml
```
Or you can [download it using this link](https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/environment.yml).
In a Terminal or Jupyter Prompt, make sure you are in folder where `environment.yml` is stored, and run:
```
conda env create -f environment.yml
```
Then, to activate the environment you just created, run:
```
conda activate AstronomicalData
```
**Run Jupyter**
If you are not familiar with Jupyter, you can [run a tutorial by clicking here](https://jupyter.org/try).
Then select "Try Classic Notebook". It will open a notebook with instructions for getting started.
Or you can run this [introductory notebook on Colab](https://colab.research.google.com/notebooks/intro.ipynb).
Before you launch Jupyter, [download this notebook](https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/test_setup.ipynb), which contains code to test your environment.
Or you can use `wget` to download it on the command line, like this:
```
wget https://raw.githubusercontent.com/AllenDowney/AstronomicalData/main/test_setup.ipynb
```
To start Jupyter, run:
```
jupyter notebook
```
Jupyter should launch your default browser or open a tab in an existing browser window.
If not, the Jupyter server should print a URL you can use. For example, when I launch Jupyter, I get
```
$ jupyter notebook
[I 10:03:20.115 NotebookApp] Serving notebooks from local directory: /home/username
[I 10:03:20.115 NotebookApp] 0 active kernels
[I 10:03:20.115 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 10:03:20.115 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
```
In this case, the URL is [http://localhost:8888](http://localhost:8888).
When you start your server, you might get a different URL.
Whatever it is, if you paste it into a browser, you should should see a home page with a list of directories.
Now open the notebook you downloaded and run the cells that contain `import` statements.
If they work and you get no error messages, **you are all set**.
If you get error messages about missing packages, you can install the packages you need using Conda or `pip`.
If you run into problems with these instructions, let us know and we will make corrections. Good luck!
+1 -1
View File
File diff suppressed because one or more lines are too long