Skip to content

Commit 03133b0

Browse files
authored
Ecliptic + RA/DEC labels + DSOs + more (#23)
* ideas * start end points * smoother curve via threshold * style * celestial equator * labels * visible * angle * constants * gridline styles * use bookworm * canonical url * tick formatters * radec labels * comment * padding to exports * bg color and map chalk style initial * styling docs * refactor style extensions * open cluster test * plot dsos * cleanup * planets * ecliptic for zenith plots * md5 hash files * abstract planet plotting * prep for v3 * start cleaning up styles and docs * format * fix ecliptic values * move * styling docs * docs * docs * styling refactor * lint * remove * float
1 parent 209dfe1 commit 03133b0

Some content is hidden

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

49 files changed

+193609
-678
lines changed

.gcp/docker.yml

-21
This file was deleted.

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM python:3.9.17-bullseye as base
1+
FROM python:3.10.12-bookworm as base
22

33
WORKDIR /starplot
44

5-
RUN apt-get update -y && apt-get install -y libgeos-dev libgdal-dev
5+
RUN apt-get update -y && apt-get install -y libgeos-dev libgdal-dev
66

77
# Install shapely from source to avoid cartopy segfault
88
# https://stackoverflow.com/questions/52374356/

Makefile

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lint:
1616
$(DOCKER_RUN) "ruff check src/ tests/"
1717

1818
format:
19-
$(DOCKER_RUN) "python -m black src/ tests/ scripts/ example.py $(ARGS)"
19+
$(DOCKER_RUN) "python -m black src/ tests/ scripts/ examples/ $(ARGS)"
2020

2121
test:
2222
$(DOCKER_RUN) "python -m pytest --cov=src/ --cov-report=term --cov-report=html ."
@@ -41,8 +41,11 @@ bash:
4141
shell:
4242
$(DOCKER_RUN) python
4343

44-
example:
45-
$(DOCKER_RUN) "python example.py"
44+
scratchpad:
45+
$(DOCKER_RUN) "python scripts/scratchpad.py"
46+
47+
examples:
48+
$(DOCKER_RUN) "cd examples && python examples.py"
4649

4750
# ------------------------------------------------------------------
4851
# Docs
@@ -73,11 +76,14 @@ ephemeris:
7376
hip8:
7477
$(DOCKER_RUN) "python ./scripts/hip.py hip_main.dat hip8.dat"
7578

79+
scripts:
80+
$(DOCKER_RUN) "python ./scripts/$(SCRIPT).py"
81+
7682
clean:
7783
rm -rf __pycache__
7884
rm -rf venv
7985
rm -rf dist
8086
rm -rf site
8187
rm -rf htmlcov
8288

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

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
## Examples
1515
*Zenith plot of the stars from a specific time/location:*
16-
![starchart-blue](https://github.com/steveberardi/starplot/blob/main/examples/starchart-blue.png?raw=true)
16+
![starchart-blue](https://github.com/steveberardi/starplot/blob/main/examples/01_star_chart.png?raw=true)
1717

1818
*Map around the constellation Orion, with M42 marked:*
19-
![map-orion](https://github.com/steveberardi/starplot/blob/main/examples/mercator-orion.png?raw=true)
19+
![map-orion](https://github.com/steveberardi/starplot/blob/main/examples/03_map_orion.svg?raw=true)
2020

2121

2222
## Basic Usage
@@ -58,9 +58,6 @@ p.export("starchart.png")
5858
## Coming Soon
5959

6060
- 🔭 Scope plots - that will simulate what you'll see through a telescope eyepiece
61-
- 🪐 More objects - including planets, and a base library of deep sky objects (DSOs)
62-
- 💫 Plotting ecliptic
63-
- 🌐 RA/DEC Labels
6461
- ⚖️ Better auto font-size adjustment
6562
- ☄️ Better label collision detection and handling
6663

docs/stylesheets/extra.css renamed to docs/css/extra.css

+19
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828
.doc-object.doc-class {
2929
border-top: 2px solid rgba(200, 200, 200, 0.6);
3030
}
31+
.doc-object.doc-class h2.doc-heading span:nth-child(3) {
32+
color:hsl(209, 53%, 37%);
33+
}
34+
.doc-object.doc-class h2.doc-heading span:nth-child(n+4) {
35+
font-size: .65rem;
36+
font-weight: 400;
37+
}
38+
.doc-object.doc-class h2.doc-heading span:nth-child(n+4).n {
39+
font-weight: 600;
40+
}
41+
42+
3143
.doc-contents.first {
3244
/* border-top: 2px solid rgba(200, 200, 200, 0.6);
3345
margin-left: 1rem;
@@ -52,6 +64,13 @@
5264
.doc-object .doc-attribute .doc-heading {
5365
margin-top: 0;
5466
}
67+
.doc-object.doc-attribute h3.doc-heading span:nth-child(3) {
68+
color:hsl(209, 53%, 37%);
69+
}
70+
.doc-object.doc-attribute h3.doc-heading span:nth-child(n+4) {
71+
font-size: .65rem;
72+
font-weight: 400;
73+
}
5574
.doc-object .doc-attribute .doc-contents {
5675
margin-bottom: 0;
5776
padding-bottom: 1rem;

docs/data-sources.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11

22
### **Stars**
3-
- XHIP: An Extended Hipparcos Compilation; Anderson E., Francis C. (2012) [VizieR V/137D](http://cdsarc.u-strasbg.fr/viz-bin/Cat?V/137D)
3+
- An Extended Hipparcos Compilation (XHIP); Anderson E., Francis C. (2012) [VizieR V/137D](http://cdsarc.u-strasbg.fr/viz-bin/Cat?V/137D)
44

55

66
### **Constellation Lines**
77
- [IAU Constellation page](http://www.iau.org/public/themes/constellations/) (via [d3-celestial](https://github.com/ofrohn/d3-celestial))
8+
- [Stellarium](https://github.com/Stellarium/stellarium/tree/master/skycultures/modern_st) (via [Sky & Telescope](https://www.skyandtelescope.com))
89

910

1011
### **Constellation Borders**

docs/examples.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import starplot as sp
1515
tz = timezone("America/Los_Angeles")
1616

1717
p = sp.ZenithPlot(
18-
lat=33.363484,
18+
lat=33.363484,
1919
lon=-116.836394,
2020
dt=tz.localize(datetime.now().replace(hour=22)),
2121
limiting_magnitude=4.6,
22-
style=sp.styles.BLUE,
22+
style=sp.styles.ZENITH_BLUE_MEDIUM,
2323
resolution=2000,
2424
)
25-
p.export("starchart.png")
25+
p.export("01_star_chart.png")
2626
```
2727
The created file should look something like this:
2828

@@ -49,7 +49,7 @@ p = sp.ZenithPlot(
4949
lon=-117.038611,
5050
dt=tz.localize(datetime.now().replace(hour=22)),
5151
limiting_magnitude=4.6,
52-
style=sp.styles.GRAYSCALE,
52+
style=sp.styles.ZENITH_GRAYSCALE,
5353
resolution=2000,
5454
)
5555
p.plot_object(
@@ -62,7 +62,7 @@ p.plot_object(
6262
},
6363
)
6464
)
65-
p.export("starchart-coma.png")
65+
p.export("02_star_chart_extra.png")
6666

6767
```
6868

@@ -76,7 +76,7 @@ The following code will create a simple map plot that shows the area around the
7676
```python
7777
import starplot as sp
7878

79-
style = sp.styles.MAP_BLUE.extend(
79+
style = sp.styles.MAP_BLUE_LIGHT.extend(
8080
{
8181
"bayer_labels": {
8282
"font_name": "GFS Didot", # use a better font for Greek letters
@@ -120,10 +120,10 @@ p.plot_object(
120120
},
121121
)
122122
)
123-
p.export("orion.svg", format="svg")
123+
p.export("03_map_orion.svg", format="svg", padding=0.5)
124124

125125

126126
```
127127
The result should look something like this:
128128

129-
![map-orion](images/mercator-orion.png)
129+
![map-orion](images/03_map_orion.svg)

0 commit comments

Comments
 (0)