Skip to content

Commit

Permalink
fix typos (#20)
Browse files Browse the repository at this point in the history
* fix typos

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
nden and pre-commit-ci[bot] authored Jul 10, 2022
1 parent 99d02d8 commit 330714b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
7 changes: 4 additions & 3 deletions 01-Introduction/01-Introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"metadata": {},
"source": [
"We looked at the well known existing ones but none were suitable to our requirements\n",
"\n",
"Our requirements:\n",
"\n",
"- Suitable as an archival format (FITS satisfies that).\n",
Expand All @@ -65,7 +66,7 @@
"- Leverage existing formats and tools to the extent possible\n",
"- Easily extensible for:\n",
" - The standard itself\n",
" - Specific science and and engineering domains\n",
" - Specific science and engineering domains\n",
" - Local or private usage\n",
"- Schemas to support validation\n",
"- Clear versioning\n",
Expand Down Expand Up @@ -173,7 +174,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -187,7 +188,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.12"
}
},
"nbformat": 4,
Expand Down
12 changes: 10 additions & 2 deletions 02_Working_With_ASDF_Files/02-Solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"**Exercise 1:**\n",
"\n",
"- Open the file `jwst.asdf` in the `02_Working_With_ASDF_Files` directory. Look at the `info` method's help and display the file using some of the arguments to show more contents.\n",
"- Search for a few attributes - `wcs`, `data`\n",
"- Search for a few attributes - `wcs`, `data`, (WCS stands for World Coordinate System. In astronomy it represents the transform from pixel coordinates to sky coordinates or some physical system.)\n",
"- Retrieve the `wcs` object following the path showed by the `search` method\n",
"- Look at the `wcs` object and print `wcs.forward_transform`\n",
"- Use matplotlib to display the data array\n",
Expand Down Expand Up @@ -151,6 +151,14 @@
"af[\"data\"][0, 0] = 999"
]
},
{
"cell_type": "markdown",
"id": "db4f1963",
"metadata": {},
"source": [
"Files are opened in `readonly` mode by default. Pass `mode=rw` to the `open` function to be able to modify them."
]
},
{
"cell_type": "markdown",
"id": "9a281209",
Expand Down Expand Up @@ -403,7 +411,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.9.12"
}
},
"nbformat": 4,
Expand Down
27 changes: 18 additions & 9 deletions 03-Creating_ASDF_Files/03-Creating_ASDF_Files.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"\n",
"All of which are stored using `yaml`. Note that more complex structures (ones not directly supported\n",
"by `yaml`) are denoted using `yaml` tags. However, those tagged \"sub-trees\" are still comprised of the\n",
"above basic structures and other tagged sub-trees. Additional tagged tagged objects are supported via\n",
"above basic structures and other tagged sub-trees. Additional tagged objects are supported via\n",
"ASDF extensions.\n",
"\n",
"The Python analogs for these types are:\n",
Expand Down Expand Up @@ -127,7 +127,7 @@
"## Creating ASDF files with `np.ndarray`\n",
"\n",
"Beyond the maps, lists, strings, and numbers built into Python, ASDF can save arrays, in particular\n",
"numpy arrays (`nd.array`). Indeed, much of ASDF is dedicated to efficiently saving arrays.\n",
"numpy arrays (`np.array`). Indeed, much of ASDF is dedicated to efficiently saving arrays.\n",
"\n",
"For example if suppose we want to save a random 8x8 numpy array:"
]
Expand Down Expand Up @@ -168,7 +168,7 @@
"id": "b386f241",
"metadata": {},
"source": [
"Observe that at the end of the file that there is apparently some binary data. This binary data contains the information\n",
"Observe that at the end of the file there is apparently some binary data. This binary data contains the information\n",
"in the random array we wrote. Indeed, when ASDF writes arrays to the file it stores them as binary data in a block after\n",
"the YAML section of the file rather in the section itself. Note that `random_array` in the YAML section stores some\n",
"information about the nature of the array and includes the `source` key. This `source` value references which binary block \n",
Expand Down Expand Up @@ -252,8 +252,8 @@
"id": "3096c0b6",
"metadata": {},
"source": [
"Notice how no additional effort was need to write the ASDF file since `asdf-astropy` was installed \n",
"already. Now lets perform a cursory inspection of the `gaussian.asdf` file:"
"Notice how no additional effort was needed to write the ASDF file since `asdf-astropy` was installed \n",
"already. Now lets perform a cursory inspection of the `table.asdf` file:"
]
},
{
Expand All @@ -276,9 +276,18 @@
"\n",
"Write an ASDF file containing the following `astropy` objects:\n",
"1. `Quantity`\n",
"2. A different model\n",
"2. A `model`\n",
"\n",
" Hint: The `astropy.modeling` package provides a framework for representing models and performing model evaluation and fitting. Models are initialized using their parameters\n",
" ```\n",
" from astropy.modeling import models\n",
" gauss = models.Gaussian1D(amplitude=10, mean=3, stddev=1.2)\n",
" ```\n",
"3. A `Time` object\n",
"4. A coordinate object."
"\n",
" Hint: The `astropy.time` package provides functionality for manipulating times and dates. To initialize it supply a string and a format, or supply a datetime object.\n",
" \n",
"4. A Celestial coordinate object (astronomy specific)."
]
},
{
Expand All @@ -290,7 +299,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.4",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -304,7 +313,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
Expand Down
21 changes: 16 additions & 5 deletions 03-Creating_ASDF_Files/03-Solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,21 @@
"source": [
"import astropy\n",
"\n",
"# Create a quantity with an array value and units of meters.\n",
"quantity = np.random.rand(8, 8) * astropy.units.m\n",
"model = astropy.modeling.models.Gaussian2D(quantity, 2, 3, 4, 5)\n",
"time = astropy.time.Time(\"J2000\")\n",
"coord = astropy.coordinates.ICRS(ra=1 * astropy.units.deg, dec=2 * astropy.units.deg)\n",
"\n",
"# Create a 2D Gaussian model\n",
"model = astropy.modeling.models.Gaussian2D(\n",
" amplitude=12.4 * astropy.units.m, x_mean=2, y_mean=3, x_stddev=4, y_stddev=5\n",
")\n",
"\n",
"# Cretae a Time object in `iso` format\n",
"time = astropy.time.Time(\"2021-07-11 00:00:00\", format=\"iso\")\n",
"\n",
"# Create a celestial coordinate\n",
"coord = astropy.coordinates.ICRS(\n",
" ra=5.67 * astropy.units.deg, dec=23.5 * astropy.units.deg\n",
")\n",
"\n",
"tree = {\n",
" \"quantity\": quantity,\n",
Expand Down Expand Up @@ -165,7 +176,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.5",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -179,7 +190,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
Expand Down
2 changes: 1 addition & 1 deletion 05-Custom_ASDF_Extensions/05-Custom-Extensions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 330714b

Please sign in to comment.