Last active
September 22, 2025 20:12
-
-
Save fommil/ccec8ed57d21c8fb52cd682cd1b719c2 to your computer and use it in GitHub Desktop.
telescopius to star-charter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DEFAULTS | |
| coords=alt_az | |
| horizon_latitude=56.30 | |
| horizon_longitude=-3.71 | |
| # TODO shame we can't set this to midnight tonight | |
| # date -d 'tomorrow 00:00' +%s | awk '{printf "%.1f\n", $1/86400 + 2440587.5}' | |
| julian_date=2460941.5 | |
| # A4 page | |
| angular_width=110 | |
| width=29.7 | |
| aspect=0.707 | |
| # show the horizon but no other curves | |
| # TODO shame we can't draw / obscure below a fixed altitude | |
| show_horizon=1 | |
| cardinals=1 | |
| grid_coords=ra_dec | |
| show_grid_lines=1 | |
| plot_galactic_plane=0 | |
| plot_ecliptic=0 | |
| plot_equator=0 | |
| plot_galaxy_map=0 | |
| # stars | |
| mag_min=8 | |
| show_solar_system=1 | |
| star_label_mag_min=0 | |
| # show all DSOs | |
| plot_dso=1 | |
| dso_display_style=fuzzy | |
| dso_mag_min=12 | |
| dso_label_mag_min=0 | |
| # minimise constellation impact | |
| constellation_boundaries=0 | |
| constellation_names=0 | |
| # turn off all legends | |
| copyright= | |
| magnitude_key=0 | |
| dso_symbol_key=0 | |
| # draw the zenith | |
| text=alt_az,90,0,0,0,1,1,0,0,0,1,+ | |
| # turn off arbitrary limits | |
| maximum_star_count=10000 | |
| maximum_star_label_count=10000 | |
| maximum_dso_count=10000 | |
| maximum_dso_label_count=10000 | |
| ####################################################### | |
| text=ra_dec,16.695000,36.461389,-1,0,1,0,0,0,0,0,Great Globular Cluster in Hercules | |
| text=ra_dec,20.569722,7.404444,-1,0,1,0,0,0,0,0,NGC 6934 | |
| text=ra_dec,15.108333,55.763333,-1,0,1,0,0,0,0,0,Spindle Galaxy | |
| text=ra_dec,17.285278,43.135833,-1,0,1,0,0,0,0,0,M 92 | |
| text=ra_dec,19.896111,18.779167,-1,0,1,0,0,0,0,0,M 71 | |
| text=ra_dec,18.893056,33.029167,-1,0,1,0,0,0,0,0,Ring Nebula | |
| text=ra_dec,19.993333,22.721111,-1,0,1,0,0,0,0,0,Dumbbell Nebula | |
| text=ra_dec,19.276667,30.183333,-1,0,1,0,0,0,0,0,M 56 | |
| text=ra_dec,21.499444,12.166944,-1,0,1,0,0,0,0,0,Pegasus Cluster | |
| text=ra_dec,21.024722,16.187778,-1,0,1,0,0,0,0,0,NGC 7006 | |
| text=ra_dec,23.082500,12.322778,-1,0,1,0,0,0,0,0,NGC 7479 | |
| text=ra_dec,19.746667,50.525000,-1,0,1,0,0,0,0,0,Blinking Planetary Nebula | |
| text=ra_dec,17.975833,66.633056,-1,0,1,0,0,0,0,0,Cat Eye Nebula | |
| text=ra_dec,20.979722,44.330000,-1,0,1,0,0,0,0,0,North America Nebula | |
| text=ra_dec,0.054167,16.145278,-1,0,1,0,0,0,0,0,NGC 7814 | |
| text=ra_dec,22.617778,34.415833,-1,0,1,0,0,0,0,0,NGC 7331 | |
| text=ra_dec,20.581111,60.153611,-1,0,1,0,0,0,0,0,Fireworks Galaxy | |
| text=ra_dec,23.431667,42.535000,-1,0,1,0,0,0,0,0,Blue Snowball Nebula | |
| text=ra_dec,1.564167,30.660278,-1,0,1,0,0,0,0,0,Triangulum Galaxy | |
| text=ra_dec,0.711667,40.865278,-1,0,1,0,0,0,0,0,Le Gentil | |
| text=ra_dec,0.672778,41.685556,-1,0,1,0,0,0,0,0,M 110 | |
| text=ra_dec,0.712222,41.268889,-1,0,1,0,0,0,0,0,Andromeda Galaxy | |
| text=ra_dec,0.553333,48.508611,-1,0,1,0,0,0,0,0,NGC 147 | |
| text=ra_dec,0.649444,48.337500,-1,0,1,0,0,0,0,0,NGC 185 | |
| text=ra_dec,2.375833,42.348333,-1,0,1,0,0,0,0,0,Outer Limits Galaxy | |
| text=ra_dec,1.705556,51.575556,-1,0,1,0,0,0,0,0,Little Dumbbell Nebula | |
| text=ra_dec,3.330000,41.511667,-1,0,1,0,0,0,0,0,Perseus A | |
| text=ra_dec,0.216944,72.521944,-1,0,1,0,0,0,0,0,Bow Tie Nebula | |
| text=ra_dec,3.780278,68.096111,-1,0,1,0,0,0,0,0,IC 342 | |
| ####################################################### | |
| CHART | |
| az_central=0 | |
| alt_central=60 | |
| output_filename=output/quad_N.pdf | |
| CHART | |
| az_central=90 | |
| alt_central=60 | |
| output_filename=output/quad_E.pdf | |
| CHART | |
| az_central=180 | |
| alt_central=60 | |
| output_filename=output/quad_S.pdf | |
| CHART | |
| az_central=270 | |
| alt_central=60 | |
| output_filename=output/quad_W.pdf | |
| # TODO would be good to provide a zoomed in view for a bunch of specific | |
| # targets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv, math, sys, re | |
| def parse_ra(s: str) -> float: | |
| """Return RA in hours (float).""" | |
| s = s.strip().replace('h',' ').replace('m',' ').replace('s',' ') | |
| s = s.replace('°',' ').replace('º',' ').replace('’',' ').replace("'",' ').replace('"',' ') | |
| parts = [p for p in re.split(r'[:\s]+', s) if p] | |
| vals = [float(p) for p in parts] | |
| if len(vals) == 1: # just a number | |
| v = vals[0] | |
| return v/15.0 if v > 24 else v | |
| elif len(vals) == 2: # degrees + arcminutes | |
| deg, amin = vals | |
| return (deg + amin/60.0)/15.0 | |
| elif len(vals) == 3: # hours/degrees, minutes, seconds | |
| return vals[0] + vals[1]/60.0 + vals[2]/3600.0 if vals[0] <= 24 \ | |
| else (vals[0] + vals[1]/60.0 + vals[2]/3600.0)/15.0 | |
| else: | |
| raise ValueError(f"Unrecognised RA format: {s}") | |
| def parse_dec(s: str) -> float: | |
| """Return Dec in degrees (float).""" | |
| sign = -1 if s.strip().startswith('-') else 1 | |
| s = s.lstrip('+-') | |
| s = s.replace('°',' ').replace('º',' ').replace('’',' ').replace("'",' ').replace('"',' ') | |
| parts = [p for p in re.split(r'[:\s]+', s) if p] | |
| vals = [float(p) for p in parts] | |
| if len(vals) == 1: | |
| return sign*vals[0] | |
| elif len(vals) == 2: | |
| d, m = vals | |
| return sign*(abs(d) + m/60.0) | |
| elif len(vals) >= 3: | |
| d, m, sec = vals[0:3] | |
| return sign*(abs(d) + m/60.0 + sec/3600.0) | |
| else: | |
| raise ValueError(f"Unrecognised Dec format: {s}") | |
| # read CSV from argv or stdin | |
| path = sys.argv[1] if len(sys.argv)>1 else None | |
| fh = open(path, newline='', encoding='utf-8') if path else sys.stdin | |
| r = csv.DictReader(fh) | |
| # Try to locate columns | |
| def find(colnames, *keys): | |
| keys = [k.lower() for k in keys] | |
| for c in colnames: | |
| lc=c.lower() | |
| if any(k in lc for k in keys): | |
| return c | |
| return None | |
| cols = r.fieldnames | |
| # Catalogue Entry,Familiar Name,Alternative Entries,Type,Constellation,Right Ascension (j2000),Declination (j2000),Magnitude,Size,Surface Brightness (mag/arcsec2),Rises over 45º,Transit Time,Sets below 45º,Maximum Altitude,Position Angle (East),Next Opposition,Notes,Right Ascension (jNow),Declination (jNow),Label | |
| ra_col = find(cols, 'Right Ascension (j2000)') | |
| dec_col = find(cols, 'Declination (j2000)') | |
| name_col= find(cols, 'Catalogue Entry') | |
| fam_col= find(cols, 'Familiar Name') | |
| if not (ra_col and dec_col): | |
| sys.exit("ERROR: Could not find RA/Dec columns in CSV header.") | |
| for row in r: | |
| ra_h = parse_ra(row[ra_col]) | |
| dec_d = parse_dec(row[dec_col]) | |
| # TODO extract the Caldwell name instead of NGC | |
| label = row[fam_col] or row[name_col] | |
| # text=<coords>,<xpos>,<ypos>,<xalign>,<yalign>,<font_size>,<bold>,<italic>,<R>,<G>,<B>,"<label>" | |
| # TODO confirm if this is truly centered | |
| # print(f'text=ra_dec,{ra_h:.6f},{dec_d:.6f},0,0,1,0,0,0,0,0,+') | |
| # TODO add more padding to the right, this won't go higher | |
| print(f'text=ra_dec,{ra_h:.6f},{dec_d:.6f},-1,0,1,0,0,0,0,0,{label}') | |
| # TODO produce a zoomed in chart for every target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment