Skip to content

Commit

Permalink
Removed config_path from SpeciesInit, updated test cases and tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Stolker committed Jan 27, 2020
1 parent 8142869 commit 3d7dc04
Show file tree
Hide file tree
Showing 21 changed files with 113 additions and 87 deletions.
6 changes: 4 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ In this case the database is stored in the working folder and an absolute path p
>>> import os
>>> os.getcwd()
A configuration file with default values is automatically created when `species` is initiated by running :class:`~species.core.setup.SpeciesInit` and no configuration file is present in the working folder, for example::
A configuration file with default values is automatically created when `species` is initiated by running :class:`~species.core.setup.SpeciesInit` in case the configuration file is not present in the working folder. *species* is now initiated with:

.. code-block:: python
import species
species.SpeciesInit(config_path='./')
species.SpeciesInit()
.. tip::
The same `data_folder` can be used in multiple configuration files. In this way, the data is only downloaded once and easily reused by a new instance of :class:`~species.core.setup.SpeciesInit`. Also the HDF5 database can be reused by simply including the same `database` in the configuration file.
9 changes: 6 additions & 3 deletions docs/tutorials/atmospheric_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
"text": [
"Initiating species v0.1.0... [DONE]\n",
"Creating species_config.ini... [DONE]\n",
"Database: /Users/tomasstolker/applications/species/docs/tutorials/species_database.hdf5\n",
"Data folder: /Users/tomasstolker/applications/species/docs/tutorials/data\n",
"Working folder: /Users/tomasstolker/applications/species/docs/tutorials\n",
"Creating species_database.hdf5... [DONE]\n",
"Creating data folder... [DONE]\n"
]
},
{
"data": {
"text/plain": [
"<species.core.setup.SpeciesInit at 0x1242a8240>"
"<species.core.setup.SpeciesInit at 0x122f74550>"
]
},
"execution_count": 2,
Expand All @@ -51,7 +54,7 @@
}
],
"source": [
"species.SpeciesInit('./')"
"species.SpeciesInit()"
]
},
{
Expand All @@ -74,7 +77,7 @@
"text": [
"Downloading DRIFT-PHOENIX model spectra (151 MB)... [DONE]\n",
"Unpacking DRIFT-PHOENIX model spectra... [DONE]\n",
"Adding DRIFT-PHOENIX model spectra... [DONE] \n"
"Adding DRIFT-PHOENIX model spectra... [DONE] \n"
]
}
],
Expand Down
17 changes: 7 additions & 10 deletions docs/tutorials/color_magnitude.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@
"text": [
"Initiating species v0.1.0... [DONE]\n",
"Creating species_config.ini... [DONE]\n",
"Database: /Users/tomasstolker/applications/species/docs/tutorials/species_database.hdf5\n",
"Data folder: /Users/tomasstolker/applications/species/docs/tutorials/data\n",
"Working folder: /Users/tomasstolker/applications/species/docs/tutorials\n",
"Creating species_database.hdf5... [DONE]\n",
"Creating data folder... [DONE]\n"
]
}
],
"source": [
"species.SpeciesInit('./')\n",
"species.SpeciesInit()\n",
"database = species.Database()"
]
},
Expand Down Expand Up @@ -274,10 +277,10 @@
"text": [
"Downloading AMES-Cond model spectra (823 MB)... [DONE]\n",
"Unpacking AMES-Cond model spectra (823 MB)... [DONE]\n",
"Adding AMES-Cond model spectra... [DONE] \n",
"Adding AMES-Cond model spectra... [DONE] \n",
"Downloading AMES-Dusty model spectra [Fe/H]=0.0 (106 MB)... [DONE]\n",
"Unpacking AMES-Dusty model spectra [Fe/H]=0.0 (106 MB)... [DONE]\n",
"Adding AMES-Dusty model spectra... [DONE] \n"
"Adding AMES-Dusty model spectra... [DONE] \n"
]
},
{
Expand Down Expand Up @@ -589,13 +592,7 @@
"\t\t- Paranal: <HDF5 group \"/objects/HR 8799 e/Paranal\" (7 members)>\n",
"\t\t\t- NACO.Lp: <HDF5 dataset \"NACO.Lp\": shape (4,), type \"<f4\">\n",
"\t\t\t- NACO.NB405: <HDF5 dataset \"NACO.NB405\": shape (4,), type \"<f4\">\n",
"\t\t\t- SPHERE.IRDIS_B_J: <HDF5 dataset \"SPHERE.IRDIS_B_J\": shape (4,), type \"<f4\">\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\t\t\t- SPHERE.IRDIS_B_J: <HDF5 dataset \"SPHERE.IRDIS_B_J\": shape (4,), type \"<f4\">\n",
"\t\t\t- SPHERE.IRDIS_D_H23_2: <HDF5 dataset \"SPHERE.IRDIS_D_H23_2\": shape (4,), type \"<f4\">\n",
"\t\t\t- SPHERE.IRDIS_D_H23_3: <HDF5 dataset \"SPHERE.IRDIS_D_H23_3\": shape (4,), type \"<f4\">\n",
"\t\t\t- SPHERE.IRDIS_D_K12_1: <HDF5 dataset \"SPHERE.IRDIS_D_K12_1\": shape (4,), type \"<f4\">\n",
Expand Down
15 changes: 10 additions & 5 deletions docs/tutorials/data_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@
"text": [
"Initiating species v0.1.0... [DONE]\n",
"Creating species_config.ini... [DONE]\n",
"Database: /Users/tomasstolker/applications/species/docs/tutorials/species_database.hdf5\n",
"Data folder: /Users/tomasstolker/applications/species/docs/tutorials/data\n",
"Working folder: /Users/tomasstolker/applications/species/docs/tutorials\n",
"Creating species_database.hdf5... [DONE]\n",
"Creating data folder... [DONE]\n"
]
},
{
"data": {
"text/plain": [
"<species.core.setup.SpeciesInit at 0x121facb38>"
"<species.core.setup.SpeciesInit at 0x12556b5f8>"
]
},
"execution_count": 2,
Expand All @@ -57,7 +60,7 @@
}
],
"source": [
"species.SpeciesInit('./')"
"species.SpeciesInit()"
]
},
{
Expand Down Expand Up @@ -103,7 +106,7 @@
"text": [
"Downloading AMES-Cond model spectra (823 MB)... [DONE]\n",
"Unpacking AMES-Cond model spectra (823 MB)... [DONE]\n",
"Adding AMES-Cond model spectra... [DONE] \n"
"Adding AMES-Cond model spectra... [DONE] \n"
]
}
],
Expand Down Expand Up @@ -468,6 +471,7 @@
"output_type": "stream",
"text": [
"Opening ModelBox...\n",
"\n",
"model = ames-cond\n",
"type = None\n",
"wavelength = [0.1 0.1001 0.1002001 ... 5.739604 5.7453437 5.751089 ]\n",
Expand Down Expand Up @@ -499,11 +503,12 @@
"output_type": "stream",
"text": [
"Opening ObjectBox...\n",
"\n",
"name = PZ Tel B\n",
"filters = ('Gemini/NICI.ED286', 'Gemini/NIRI.H2S1v2-1-G0220', 'Paranal/NACO.H', 'Paranal/NACO.J', 'Paranal/NACO.Ks', 'Paranal/NACO.Lp', 'Paranal/NACO.Mp', 'Paranal/NACO.NB405', 'Paranal/SPHERE.IRDIS_D_H23_2', 'Paranal/SPHERE.IRDIS_D_H23_3', 'Paranal/SPHERE.IRDIS_D_K12_1', 'Paranal/SPHERE.IRDIS_D_K12_2', 'Paranal/SPHERE.ZIMPOL_I_PRIM', 'Paranal/SPHERE.ZIMPOL_R_PRIM')\n",
"filters = ['Gemini/NICI.ED286', 'Gemini/NIRI.H2S1v2-1-G0220', 'Paranal/NACO.H', 'Paranal/NACO.J', 'Paranal/NACO.Ks', 'Paranal/NACO.Lp', 'Paranal/NACO.Mp', 'Paranal/NACO.NB405', 'Paranal/SPHERE.IRDIS_D_H23_2', 'Paranal/SPHERE.IRDIS_D_H23_3', 'Paranal/SPHERE.IRDIS_D_K12_1', 'Paranal/SPHERE.IRDIS_D_K12_2', 'Paranal/SPHERE.ZIMPOL_I_PRIM', 'Paranal/SPHERE.ZIMPOL_R_PRIM']\n",
"magnitude = {'Gemini/NICI.ED286': array([11.68, 0.14], dtype=float32), 'Gemini/NIRI.H2S1v2-1-G0220': array([11.39, 0.14], dtype=float32), 'Paranal/NACO.H': array([11.93, 0.14], dtype=float32), 'Paranal/NACO.J': array([12.47, 0.2 ], dtype=float32), 'Paranal/NACO.Ks': array([11.53, 0.07], dtype=float32), 'Paranal/NACO.Lp': array([11.04, 0.22], dtype=float32), 'Paranal/NACO.Mp': array([10.93, 0.03], dtype=float32), 'Paranal/NACO.NB405': array([10.94, 0.07], dtype=float32), 'Paranal/SPHERE.IRDIS_D_H23_2': array([11.78, 0.19], dtype=float32), 'Paranal/SPHERE.IRDIS_D_H23_3': array([11.65, 0.19], dtype=float32), 'Paranal/SPHERE.IRDIS_D_K12_1': array([11.56, 0.09], dtype=float32), 'Paranal/SPHERE.IRDIS_D_K12_2': array([11.29, 0.1 ], dtype=float32), 'Paranal/SPHERE.ZIMPOL_I_PRIM': array([15.16, 0.12], dtype=float32), 'Paranal/SPHERE.ZIMPOL_R_PRIM': array([17.84, 0.31], dtype=float32)}\n",
"flux = {'Gemini/NICI.ED286': array([2.7825625e-14, 3.5979198e-15], dtype=float32), 'Gemini/NIRI.H2S1v2-1-G0220': array([1.0590437e-14, 1.3693687e-15], dtype=float32), 'Paranal/NACO.H': array([1.9687588e-14, 2.5456521e-15], dtype=float32), 'Paranal/NACO.J': array([3.1106848e-14, 5.7625536e-15], dtype=float32), 'Paranal/NACO.Ks': array([1.1241627e-14, 7.2527667e-16], dtype=float32), 'Paranal/NACO.Lp': array([2.0200626e-15, 4.1212692e-16], dtype=float32), 'Paranal/NACO.Mp': array([9.1877844e-16, 2.5390018e-17], dtype=float32), 'Paranal/NACO.NB405': array([1.6704631e-15, 1.0777336e-16], dtype=float32), 'Paranal/SPHERE.IRDIS_D_H23_2': array([2.5412999e-14, 4.4699182e-15], dtype=float32), 'Paranal/SPHERE.IRDIS_D_H23_3': array([2.4269955e-14, 4.2688669e-15], dtype=float32), 'Paranal/SPHERE.IRDIS_D_K12_1': array([1.1547812e-14, 9.5833011e-16], dtype=float32), 'Paranal/SPHERE.IRDIS_D_K12_2': array([1.1428121e-14, 1.0540576e-15], dtype=float32), 'Paranal/SPHERE.ZIMPOL_I_PRIM': array([1.0862880e-14, 1.2030557e-15], dtype=float32), 'Paranal/SPHERE.ZIMPOL_R_PRIM': array([1.8263311e-15, 5.2856905e-16], dtype=float32)}\n",
"distance = 47.13\n",
"distance = 47.130001068115234\n",
"spectrum = None\n"
]
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/fitting_photometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
],
"source": [
"species.SpeciesInit('./')"
"species.SpeciesInit()"
]
},
{
Expand Down
9 changes: 6 additions & 3 deletions docs/tutorials/flux_magnitude.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
"text": [
"Initiating species v0.1.0... [DONE]\n",
"Creating species_config.ini... [DONE]\n",
"Database: /Users/tomasstolker/applications/species/docs/tutorials/species_database.hdf5\n",
"Data folder: /Users/tomasstolker/applications/species/docs/tutorials/data\n",
"Working folder: /Users/tomasstolker/applications/species/docs/tutorials\n",
"Creating species_database.hdf5... [DONE]\n",
"Creating data folder... [DONE]\n"
]
},
{
"data": {
"text/plain": [
"<species.core.setup.SpeciesInit at 0x10ca7aeb8>"
"<species.core.setup.SpeciesInit at 0x1083eff28>"
]
},
"execution_count": 1,
Expand All @@ -35,7 +38,7 @@
],
"source": [
"import species\n",
"species.SpeciesInit('./')"
"species.SpeciesInit()"
]
},
{
Expand All @@ -58,7 +61,7 @@
"text": [
"Adding filter: JWST/NIRCam.F115W... [DONE]\n",
"Downloading Vega spectrum (270 kB)... [DONE]\n",
"Adding Vega spectrum... [DONE]\n",
"Adding Vega spectrum...[DONE]\n",
"Flux density [W m-2 micron-1] = 4.15e-15 +/- 7.69e-16\n"
]
}
Expand Down

0 comments on commit 3d7dc04

Please sign in to comment.