Skip to content

Commit

Permalink
Added bortle classes, radius=3
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosseel committed Oct 22, 2024
1 parent 6e111c7 commit 8429089
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/PiFinder/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def solver(
solved |= solution

# Calculate SQM
measured_sqm = sqm.calculate(solved["FOV"], centroids, solution, np_image)
measured_sqm = sqm.calculate(solved["FOV"], centroids, solution, np_image, radius=3)
solved["SQM"] = measured_sqm

total_tetra_time = t_extract + solved["T_solve"]
Expand Down
132 changes: 131 additions & 1 deletion python/PiFinder/ui/sqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,27 @@ def update(self, force=False):
fill=self.colors.get(128),
)
else:
sqm = self.shared_state.solution()["SQM"][0]
self.draw.text(
(10, 30),
f"{self.shared_state.solution()['SQM'][0]:.2f}",
f"{sqm:.2f}",
font=self.fonts.huge.font,
fill=self.colors.get(128),
)
details = self.get_sky_details(sqm)
self.draw.text(
(10, 80),
f"{details['title']}",
font=self.fonts.base.font,
fill=self.colors.get(128),
)
self.draw.text(
(10, 90),
f"Bortle {details['bortle_class']}",
font=self.fonts.bold.font,
fill=self.colors.get(128),
)

return self.screen_update()

# def key_up(self):
Expand All @@ -50,3 +65,118 @@ def active(self):
Called when a module becomes active
i.e. foreground controlling display
"""

def get_sky_details(self, mag_arcsec):
"""
Takes a mag/arcsec² value and returns corresponding Bortle scale details.
Source: https://www.juliandarkskynetwork.com/sky-quality.html
Args:
mag_arcsec (float): The magnitude per square arcsecond value
Returns:
dict: Dictionary containing all Bortle scale properties for the given magnitude
"""
scale = [
{
'bortle_class': 1,
'title': 'Excellent Dark Sky Site',
'nelm_range': (7.6, 8.0),
'mag_arcsec_range': (21.99, 22.00),
'description': [
'Zodiacal light visible; M33 direct vision naked eye object;',
'Regions of the Milky Way cast obvious shadows on the ground;',
'surroundings basically invisible.'
]
},
{
'bortle_class': 2,
'title': 'Typical True Dark Sky Site',
'nelm_range': (7.1, 7.5),
'mag_arcsec_range': (21.89, 21.99),
'description': [
'Highly structured summer Milky Way;',
'distinctly yellowish zodiacal light bright enough to cast shadows',
'at dusk and dawn.'
]
},
{
'bortle_class': 3,
'title': 'Rural Sky',
'nelm_range': (6.6, 7.0),
'mag_arcsec_range': (21.69, 21.89),
'description': [
'Low light domes (10 to 15 degrees) on horizon.',
'M33 easy with averted vision.',
'Milky way shows bulge.'
]
},
{
'bortle_class': 4,
'title': 'Rural / Suburban Transition',
'nelm_range': (6.2, 6.5),
'mag_arcsec_range': (21.25, 21.69),
'description': [
'Zodiacal light seen on best nights.',
'Milky way shows much dark lane structure with beginnings of faint bulge.',
'M33 difficult even when above 50 degrees.'
]
},
{
'bortle_class': 4.5,
'title': 'Suburban Sky',
'nelm_range': (5.9, 6.2),
'mag_arcsec_range': (20.49, 21.25),
'description': [
'Some dark lanes in Milky Way but no bulge.',
'Washed out Milky Way visible near horizon.',
'Zodiacal light very rare. Light domes up to 45 degrees.'
]
},
{
'bortle_class': 5,
'title': 'Bright Suburban Sky',
'nelm_range': (5.6, 5.9),
'mag_arcsec_range': (19.50, 20.49),
'description': [
'Milky Way washed out at zenith and invisible at horizon.',
'Many light domes. Clouds are brighter than sky.'
]
},
{
'bortle_class': (6, 7),
'title': 'Suburban / Urban Transition or Full Moon',
'nelm_range': (5.0, 5.5),
'mag_arcsec_range': (18.38, 19.50),
'description': [
'Milky Way at best very faint at zenith. M31 difficult and indistinct.',
'Sky is grey up to 35 degrees.'
]
},
{
'bortle_class': (8, 9),
'title': 'City Sky',
'nelm_range': (3.0, 4.0),
'mag_arcsec_range': (0, 18.38),
'description': [
'Entire sky is grayish or brighter.',
'Familiar constellations are missing stars.',
'Most people don\'t look up.'
]
}
]

# Find matching range
for props in scale:
min_mag_arcsec, max_mag_arcsec = props['mag_arcsec_range']
if min_mag_arcsec <= mag_arcsec <= max_mag_arcsec:
return {
'bortle_class': props['bortle_class'],
'title': props['title'],
'nelm_range': f"{props['nelm_range'][0]} - {props['nelm_range'][1]}",
'mag_arcsec_range': f"{min_mag_arcsec} - {max_mag_arcsec}",
'description': props['description']
}

return None

0 comments on commit 8429089

Please sign in to comment.