topskill.dev
CoursesTracks
All courses/Intro to NumPy: Pocket ObservatoryImport NumPy as np
1. Launchpad: Why NumPy and Your First Array
2 / 11
← Intro to NumPy: Pocket Observatory
○What is NumPy?●Import NumPy as np○Turn a list into an array○Exercise: Decode a sensor feed○Build a two-dimensional grid○Exercise: Map station rows○Stack observation frames○Exercise: Stack sky snapshots○Read shape and size○Exercise: Label any observation✦Module Quiz
○Mark ticks and intervals○Exercise: Schedule sensor samples○Reserve blank and active grids○Exercise: Prime observation panels○Build patterns without loops○Exercise: Wire a sensor pattern○Replay seeded samples○Exercise: Simulate three station feeds○Choose and convert element types○Exercise: Label observation types✦Module Quiz
○Pick readings by position○Exercise: choose a signal pair○Read a sky grid○Exercise: trace a grid column○Cut a stepped window○Exercise: mute alternating samples○Mark noisy readings○Exercise: censor weak signals○See a view change its source○Exercise: preserve a calibration snapshot✦Module Quiz
○Scale every reading○Exercise: calibrate a pressure series○Combine matching readings○Exercise: find sensor agreement○Find a usable band○Exercise: flag an observation window○Apply functions to a full array○Exercise: transform a light curve○Reuse column offsets across rows○Exercise: correct a horizon map○Give each grid row its own baseline○Exercise: calibrate rows and reject bad shapes✦Module Quiz
○Find the loudest reading○Locate sensor extremes○Choose an axis○Summarize both directions○Keep a running tally○Build an interval counter○Describe a series○Compare center and spread○Sort within rows○Order each observation○Project: read the panel○Project: flag variability✦Module Quiz
○Read the grid○Select a sensor history○Transpose a grid○Turn a scoreboard○Weight a reading○Compute a weighted score○Combine matrix dimensions○Transform a whole panel○Project: calibrate the panel○Project: report calibrated peaks✦Module Quiz
○Fold a signal○Exercise: pack star counts○Trace shared readings○Exercise: audit a view○Raise a new axis○Exercise: align calibration○Stamp a pattern○Exercise: build exposure plan○Read a tiny CSV○Exercise: save and read CSV○Final project: Pocket Observatory report✦Module Quiz

Import NumPy as np

The course examples are ready to use NumPy. You don't need to install anything to run them here.

Start a NumPy program with import numpy as np. The as np part gives the library a short name. When you write np.array(...), you're asking NumPy to create an array.

python
import numpy as np
print(np.array([8, 13]).tolist())

Press Run and look for [8, 13]. Each example includes its own import because the blocks run independently.

In the following lesson, main.py will be editable. Run shows what your program does; Submit checks the requested change. The import is supplied there, so you can focus on the array.

Optional: use NumPy on your computer

If you're staying in the course editor, skip this section.

If Python is already installed on your computer, open a terminal in a practice folder and create a virtual environment. This is a separate folder for the project's Python packages; it keeps them apart from packages used by other projects.

On Windows, run these commands one at a time:

powershell
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install numpy
.\.venv\Scripts\python.exe -c "import numpy as np; print(np.array([8, 13]))"

On macOS or Linux:

bash
python3 -m venv .venv
.venv/bin/python -m pip install numpy
.venv/bin/python -c "import numpy as np; print(np.array([8, 13]))"

These commands use the environment's Python directly, so you don't need to activate it. The final command should print [ 8 13]; spacing can differ from Python's list display. Use that same environment's Python when you run a saved .py file.

If venv isn't available on Linux, install your distribution's Python virtual-environment package first. Local setup is optional; it doesn't affect the course checks.