Skip to content

Commit a6e6b31

Browse files
samaloneynabobalis
andauthored
Apply suggestions from code review
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
1 parent fd3864d commit a6e6b31

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""
22
===============================================
3-
How to create an gWCS from quantities and times
3+
How to create an GWCS from quantities and times
44
===============================================
55
6-
This example shows to create a gWCS from quantities in this example time and energy.
7-
6+
This example shows how to create a GWCS from astropy quantities.
87
"""
9-
108
import numpy as np
119
from matplotlib import pyplot as plt
1210

@@ -18,13 +16,13 @@
1816
from ndcube.wcs.wrappers import CompoundLowLevelWCS
1917

2018
##############################################################################
21-
# First we create our coordinate arrays.
19+
# We aim to create coordinates that are focused around time and energies using astropy quantities.
2220

2321
energy = np.arange(10) * u.keV
2422
time = Time('2020-01-01 00:00:00') + np.arange(9)*u.s
2523

2624
##############################################################################
27-
# Then we use use
25+
# Then, we need to turn these into lookup tables using
2826
# `~ndcube.extra_coords.table_coord.QuantityTableCoordinate` and
2927
# `~ndcube.extra_coords.table_coord.TimeTableCoordinate` to create table coordinates.
3028

@@ -35,21 +33,24 @@
3533
print(time_coord)
3634

3735
##############################################################################
38-
# Create new `~ndcube.wcs.wrappers.compound_wcs.CompoundLowLevelWCS` instance using the previously created table
39-
# coordinates WCSs (note the ordering).
36+
# Now we need to create a `~ndcube.wcs.wrappers.compound_wcs.CompoundLowLevelWCS` instance
37+
# using the previously created table coordinates.
38+
# Please note the ordering, it is important to make sure you are assigning them
39+
# in the correct order.
4040

4141
wcs = CompoundLowLevelWCS(time_coord.wcs, energy_coord.wcs, )
4242
print(wcs)
4343

4444
##############################################################################
45-
# Finally we make a data array and create new `~ndcube.NDCube` with this data and the gWCS we just created.
45+
# Now, we have all of the pieces required to construct a `~ndcube.NDCube` with this data and the GWCS we just created.
4646

4747
data = np.random.rand(len(time), len(energy))
4848
cube = NDCube(data=data, wcs=wcs)
4949
print(cube)
5050

5151
##############################################################################
52-
# Make a plot
52+
# Finally, we will plot the cube.
5353

5454
cube.plot()
55+
5556
plt.show()

0 commit comments

Comments
 (0)