Skip to content

Commit 5982603

Browse files
authored
v0.6.0 (#40)
* grayscale dark * scope * initial scope plots * handle wrapping * star sizing * style * optic plot * more optic types * docs * cleanup * fix clipping * optic labels * optic labels * planets and moon * python version testing * remove 3.8 * python 312 * refactor docker * python version testing * no dots * python version testing * fix * format * clean up * docs * examples * optic projections * clean up * replace old * cleanup * version * cleanup * readme * readme * examples * time * in bounds * tests * tests * format * alternate color hash * fix fov circle * hash * lint * finder chart script * star labels * styling * legends on optic plot * reticle * docs * docs * info text style * doc * docs * python version * fix polar query and optimize * format * optimizations * polaris test * format * refactor * fix star bounds * label bounds * reorg * optics * use parquet * test exceptions * docs
1 parent 3969385 commit 5982603

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1820
-336
lines changed

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ jobs:
1010
runs-on: ubuntu-22.04
1111
steps:
1212
- uses: actions/checkout@v3
13-
- name: Build Docker image - dev
14-
run: make docker-dev
13+
- name: Build Docker Image
14+
run: make build
1515
- name: Check Lint
1616
run: make lint CI=true
1717
- name: Check Format
1818
run: make format CI=true ARGS=--check
1919
- name: Run Tests
2020
run: make test CI=true
2121
- name: Build
22-
run: make build
22+
run: make flit-build
2323
- name: Publish
2424
env:
2525
FLIT_USERNAME: __token__
2626
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
27-
run: make publish
27+
run: make flit-publish

.github/workflows/test.yml

+29-5
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,41 @@ on:
88
- main
99

1010
jobs:
11-
test:
11+
test-lint-build:
1212
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Build Docker image - dev
16-
run: make docker-dev
15+
- name: Build Docker Image
16+
run: make build
1717
- name: Check Lint
1818
run: make lint CI=true
1919
- name: Check Format
2020
run: make format CI=true ARGS=--check
2121
- name: Run Tests
2222
run: make test CI=true
23-
- name: Build
24-
run: make build
23+
- name: Build PIP Package
24+
run: make flit-build
25+
test-python-3-9:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Run Tests - Python 3.9
30+
run: make test-3.9 CI=true
31+
test-python-3-10:
32+
runs-on: ubuntu-22.04
33+
steps:
34+
- uses: actions/checkout@v3
35+
- name: Run Tests - Python 3.10
36+
run: make test-3.10 CI=true
37+
test-python-3-11:
38+
runs-on: ubuntu-22.04
39+
steps:
40+
- uses: actions/checkout@v3
41+
- name: Run Tests - Python 3.11
42+
run: make test-3.11 CI=true
43+
test-python-3-12:
44+
runs-on: ubuntu-22.04
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: Run Tests - Python 3.12
48+
run: make test-3.12 CI=true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ hip8.dat
2020

2121
temp*
2222

23+
*.prof
24+
2325
# test-generated data
2426
tests/data/actual*.png
2527

Dockerfile

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM python:3.11.4-bookworm as base
1+
ARG PYTHON_VERSION=3.11.7
2+
FROM python:${PYTHON_VERSION}-bookworm AS base
23

34
WORKDIR /starplot
45

@@ -11,18 +12,6 @@ RUN wget https://github.com/google/fonts/raw/main/ofl/gfsdidot/GFSDidot-Regular.
1112
RUN install -m644 /tmp/fonts/*.ttf /usr/share/fonts/truetype/
1213
RUN fc-cache -f
1314

14-
# ---------------------------------------------------------------------
15-
FROM python:3.10.12-bookworm as base310
16-
17-
WORKDIR /starplot
18-
19-
RUN apt-get update -y && apt-get install -y libgeos-dev libgdal-dev
20-
21-
# MAYBE REQUIRED for Python 3.10.x? TODO: investigate more
22-
# Install shapely from source to avoid cartopy segfault
23-
# https://stackoverflow.com/questions/52374356/
24-
RUN pip install --no-binary :all: shapely==2.0.1
25-
2615
# ---------------------------------------------------------------------
2716
FROM base as dev
2817

@@ -37,4 +26,4 @@ ENV PYTHONPATH=/starplot/src/
3726

3827
RUN git config --global --add safe.directory /starplot
3928

40-
CMD ["bash"]
29+
CMD ["bash", "-c", "python -m pytest ."]

Makefile

+48-20
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,30 @@ else
77
DR_ARGS=-it
88
endif
99

10+
ifeq ($(PROFILE), true)
11+
SCRATCH_ARGS=-m cProfile -o results.prof
12+
else
13+
SCRATCH_ARGS=
14+
endif
15+
1016
DOCKER_RUN=docker run --rm $(DR_ARGS) -v $(shell pwd):/starplot starplot-dev bash -c
1117
DOCKER_BUILDER=starplot-builder
1218

19+
DOCKER_BUILD_PYTHON=docker build -t starplot-$(PYTHON_VERSION) $(DOCKER_BUILD_ARGS) --build-arg="PYTHON_VERSION=$(PYTHON_VERSION)" --target dev .
20+
DOCKER_RUN_PYTHON_TEST=docker run --rm $(DR_ARGS) -v $(shell pwd):/starplot starplot-$(PYTHON_VERSION)
21+
1322
export PYTHONPATH=./src/
1423

24+
# ------------------------------------------------------------------
25+
build: PYTHON_VERSION=3.11.7
26+
build: DOCKER_BUILD_ARGS=-t starplot-dev
27+
build:
28+
$(DOCKER_BUILD_PYTHON)
29+
30+
docker-multi-arch:
31+
docker buildx inspect $(DOCKER_BUILDER) && echo "Builder already exists!" || docker buildx create --name $(DOCKER_BUILDER) --bootstrap --use
32+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag sberardi/starplot-base:latest --target base .
33+
1534
lint:
1635
$(DOCKER_RUN) "ruff check src/ tests/"
1736

@@ -21,32 +40,41 @@ format:
2140
test:
2241
$(DOCKER_RUN) "python -m pytest --cov=src/ --cov-report=term --cov-report=html ."
2342

24-
docker-dev:
25-
docker build -t starplot-dev --target dev .
26-
27-
docker-base:
28-
docker build -t starplot-base --target base .
29-
docker tag starplot-base sberardi/starplot-base:latest
30-
31-
docker-base-push:
32-
docker push sberardi/starplot-base:latest
33-
34-
docker-multi-arch:
35-
docker buildx inspect $(DOCKER_BUILDER) && echo "Builder already exists!" || docker buildx create --name $(DOCKER_BUILDER) --bootstrap --use
36-
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag sberardi/starplot-base:latest --target base .
37-
3843
bash:
3944
$(DOCKER_RUN) bash
4045

4146
shell:
4247
$(DOCKER_RUN) python
4348

4449
scratchpad:
45-
$(DOCKER_RUN) "python scripts/scratchpad.py"
50+
$(DOCKER_RUN) "python $(SCRATCH_ARGS) scripts/scratchpad.py"
4651

4752
examples:
4853
$(DOCKER_RUN) "cd examples && python examples.py"
4954

55+
# ------------------------------------------------------------------
56+
# Python version testing
57+
# ------------------------------------------------------------------
58+
test-3.9: PYTHON_VERSION=3.9.18
59+
test-3.9:
60+
$(DOCKER_BUILD_PYTHON)
61+
$(DOCKER_RUN_PYTHON_TEST)
62+
63+
test-3.10: PYTHON_VERSION=3.10.13
64+
test-3.10:
65+
$(DOCKER_BUILD_PYTHON)
66+
$(DOCKER_RUN_PYTHON_TEST)
67+
68+
test-3.11: PYTHON_VERSION=3.11.7
69+
test-3.11:
70+
$(DOCKER_BUILD_PYTHON)
71+
$(DOCKER_RUN_PYTHON_TEST)
72+
73+
test-3.12: PYTHON_VERSION=3.12.1
74+
test-3.12:
75+
$(DOCKER_BUILD_PYTHON)
76+
$(DOCKER_RUN_PYTHON_TEST)
77+
5078
# ------------------------------------------------------------------
5179
# Docs
5280
docs-serve: DR_ARGS=-it -p 8000:8000
@@ -61,11 +89,11 @@ docs-publish:
6189

6290
# ------------------------------------------------------------------
6391
# PyPi - build & publish
64-
build:
92+
flit-build:
6593
$(DOCKER_RUN) "python -m flit build"
6694

67-
publish: DR_ARGS=-e FLIT_USERNAME -e FLIT_PASSWORD
68-
publish:
95+
flit-publish: DR_ARGS=-e FLIT_USERNAME -e FLIT_PASSWORD
96+
flit-publish:
6997
$(DOCKER_RUN) "python -m flit publish"
7098

7199
# ------------------------------------------------------------------
@@ -74,7 +102,7 @@ ephemeris:
74102
$(DOCKER_RUN) "python -m jplephem excerpt 2001/1/1 2050/1/1 $(DE421_URL) de421sub.bsp"
75103

76104
hip8:
77-
$(DOCKER_RUN) "python ./scripts/hip.py hip_main.dat hip8.dat"
105+
$(DOCKER_RUN) "python ./scripts/hip.py ./src/starplot/data/library/hip_main.dat hip8.dat 15"
78106

79107
scripts:
80108
$(DOCKER_RUN) "python ./scripts/$(SCRIPT).py"
@@ -86,4 +114,4 @@ clean:
86114
rm -rf site
87115
rm -rf htmlcov
88116

89-
.PHONY: install test shell build publish clean ephemeris hip8 scratchpad examples scripts
117+
.PHONY: install test shell flit-build flit-publish clean ephemeris hip8 scratchpad examples scripts

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# <img src="https://raw.githubusercontent.com/steveberardi/starplot/main/docs/images/favicon.svg" width="48" style="vertical-align:middle"> Starplot
22
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/steveberardi/starplot/test.yml?style=for-the-badge&color=a2c185)
3+
![Python](https://img.shields.io/pypi/pyversions/starplot?style=for-the-badge&color=85A2C1)
34
![PyPI](https://img.shields.io/pypi/v/starplot?style=for-the-badge&color=85C0C1)
45
![License](https://img.shields.io/github/license/steveberardi/starplot?style=for-the-badge&color=A485C1)
56

67
**Starplot** is a Python library for creating star charts and maps.
78

89
-**Zenith Plots** - showing the stars from a specific time/location
910
- 🗺️ **Map Plots** - including North/South polar and Mercator projections
11+
- 🔭 **Optic Plots** - simulates what you'll see through an optic (e.g. binoculars, telescope) from a time/location
1012
- 🪐 **Planets and Deep Sky Objects (DSOs)**
1113
- 🎨 **Custom Styles** - for all objects
1214
- 📥 **Export** - png, svg
@@ -19,6 +21,8 @@
1921
*Map around the constellation Orion, with M42 marked:*
2022
![map-orion](https://github.com/steveberardi/starplot/blob/main/examples/03_map_orion.png?raw=true)
2123

24+
*Optic plot of The Pleiades through a refractor as seen from a specific time/location:*
25+
![optic-pleiades](https://github.com/steveberardi/starplot/blob/main/examples/05_optic_m45.png?raw=true)
2226

2327
## Basic Usage
2428

@@ -63,8 +67,6 @@ For a demo of Starplot's zenith plots, check out:
6367
- adjustText
6468

6569
## Coming Soon
66-
- ⭐ Custom markers
67-
- 🔭 Scope plots - that will simulate what you'll see through a telescope eyepiece
6870
- ⚖️ Better auto font-size adjustment
6971
- ☄️ Better label collision detection and handling
7072

docs/css/extra.css

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
font-weight: 600;
2626
}
2727

28+
/* Object Class Headings */
2829
.doc-object.doc-class {
2930
border-top: 2px solid rgba(200, 200, 200, 0.6);
3031
}
@@ -39,6 +40,21 @@
3940
font-weight: 600;
4041
}
4142

43+
/* Object Class Headings */
44+
.doc-object.doc-class h3.doc-heading span:nth-child(5) {
45+
color:hsl(209, 53%, 37%);
46+
}
47+
.doc-object.doc-class h3.doc-heading span:nth-child(n+6) {
48+
font-size: .65rem;
49+
font-weight: 400;
50+
}
51+
.doc-object.doc-class h3.doc-heading span:nth-child(n+6).n {
52+
font-weight: 600;
53+
}
54+
55+
.doc-function h3.doc-heading span:nth-child(n+2) {
56+
color: var(--md-code-hl-name-color) !important;
57+
}
4258

4359
.indent {
4460
margin-left: 1rem;

docs/examples.md

+24-8
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,57 @@ This page has a few examples to get you familiar with Starplot and how it works.
44
2. [Star Chart with an Extra Object Plotted](#star-chart-with-an-extra-object-plotted)
55
3. [Map of Orion](#map-of-orion)
66
4. [Map of The Pleiades with a Scope Field of View](#map-of-the-pleiades-with-a-scope-field-of-view)
7+
5. [Optic plot of The Pleiades with a Refractor Telescope](#optic-plot-of-the-pleiades-with-a-refractor-telescope)
78

89

910

1011
## Star Chart for Time/Location
1112
To create a star chart for the sky as seen from [Palomar Mountain](https://en.wikipedia.org/wiki/Palomar_Mountain) in California on July 13, 2023 at 10pm PT:
1213

1314
```python
14-
{% include 'examples/example_1.py' %}
15+
{% include 'examples/example_01.py' %}
1516
```
1617

1718
The created file should look like this:
1819

19-
![starchart-blue](images/example_1.png)
20+
![starchart-blue](images/example_01.png)
2021

2122

2223
## Star Chart with an Extra Object Plotted
2324

2425
Building on the first example, you can also plot additional objects and even customize their style. Here's an example that plots the [Coma Star Cluster](https://en.wikipedia.org/wiki/Coma_Star_Cluster) (Melotte 111) as a red star and also changes the plot style to `GRAYSCALE`:
2526

2627
```python
27-
{% include 'examples/example_2.py' %}
28+
{% include 'examples/example_02.py' %}
2829
```
2930

30-
![zenith-coma](images/example_2.png)
31+
![zenith-coma](images/example_02.png)
3132

3233

3334
## Map of Orion
3435

3536
The following code will create a simple map plot that shows the area around the constellation Orion, including a legend and an extra marker for M42 - [The Great Orion Nebula](https://en.wikipedia.org/wiki/Orion_Nebula):
3637

3738
```python
38-
{% include 'examples/example_3.py' %}
39+
{% include 'examples/example_03.py' %}
3940
```
4041

4142
The result should look like this:
4243

43-
![map-orion](images/example_3.png)
44+
![map-orion](images/example_03.png)
4445

4546

4647
## Map of The Pleiades with a Scope Field of View
4748

4849
The following code will create a minimal map plot that shows the field of view (red dashed circle) of [The Pleiades (M45)](https://en.wikipedia.org/wiki/Pleiades) when looking through a [Tele Vue 85](https://www.televue.com/engine/TV3b_page.asp?id=26) telescope with a 14mm eyepiece that has a 82 degree FOV:
4950

5051
```python
51-
{% include 'examples/example_4.py' %}
52+
{% include 'examples/example_04.py' %}
5253
```
5354

5455
The result should look like this:
5556

56-
![map-pleiades-scope](images/example_4.png)
57+
![map-pleiades-scope](images/example_04.png)
5758

5859
!!! tip "Binocular Field of View"
5960

@@ -63,6 +64,21 @@ The result should look like this:
6364
p.plot_bino_fov(ra=3.78361, dec=24.11667, fov=65, magnification=10)
6465
```
6566

67+
68+
## Optic plot of The Pleiades with a Refractor Telescope
69+
70+
The following code will create an optic plot that shows what The Pleiades looked like through a refractor telescope on December 16, 2023 at 9pm PT from Palomar Mountain in California.
71+
72+
```python
73+
{% include 'examples/example_05.py' %}
74+
```
75+
76+
The result should look like this:
77+
78+
![optic-m45](images/example_05.png)
79+
80+
81+
6682
---
6783

6884
*Check out the code reference to learn more about using starplot!*

docs/images/example_01.png

632 KB
Loading

docs/images/example_02.png

607 KB
Loading

docs/images/example_03.png

1010 KB
Loading

docs/images/example_04.png

52.6 KB
Loading

docs/images/example_05.png

173 KB
Loading

0 commit comments

Comments
 (0)