Skip to content

Commit 3a329a0

Browse files
committed
Sky Quality Update
1 parent c74ebd2 commit 3a329a0

File tree

10 files changed

+361
-155
lines changed

10 files changed

+361
-155
lines changed

.DS_Store

6 KB
Binary file not shown.

Data/.DS_Store

6 KB
Binary file not shown.

Data/.ipynb_checkpoints/scatterplot-checkpoint.ipynb

Lines changed: 155 additions & 0 deletions
Large diffs are not rendered by default.

Data/SQM.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from numpy import *
2+
from scipy.interpolate import *
3+
from matplotlib.pyplot import *
4+
from scipy.stats import *
5+
6+
#The Data
7+
population_density = array([1901, 1292, 1423.6, 1069.2, 731.9, 2163.9, 1467.7, 327.6, 768.5, 2.4])
8+
population = array ([94192, 1129, 6619, 2023, 2486, 23691, 14504, 172, 2376, 146])
9+
sqm = array([16.15, 17.17, 16.88, 17.44, 19.11, 15.87, 16.89, 19.79, 18.57, 21.35])
10+
print(population_density)
11+
print(population)
12+
print(sqm)
13+
14+
#Finds the formula to describe the correlation between population density and photopollution
15+
p1 = polyfit(population_density,sqm,1)
16+
print(p1)
17+
#Finds the correlation coefficient in the case of population density
18+
slope,intercept,r_value,p_value,std_err = linregress(population_density,sqm)
19+
correlation = (pow(r_value,2))
20+
print(correlation)
21+
#Finds the formula to describe the correlation between population and photopollution (Normalization of Walker's Law.)
22+
p2 = polyfit(population,sqm,1)
23+
print(p2)
24+
#Finds the correlation coefficient in the case of population
25+
slope,intercept2,r_value2,p_value2,std_err2 = linregress(population,sqm)
26+
correlation2 = (pow(r_value2,2))
27+
print (correlation2)
28+
#Calculate Standard Deviation
29+
stddev = std(sqm)
30+
print(stddev)
985 Bytes
Binary file not shown.

Data/scatterplot.ipynb

Lines changed: 155 additions & 0 deletions
Large diffs are not rendered by default.

Program.py

Lines changed: 0 additions & 118 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,19 @@ Welcome to the Photopollution Calculator. This program is based on the mathemati
88
99
To run this program you will need:
1010

11-
* Python (Preferably Python 2.7)
11+
* Python 3
1212
* Pandas
1313
* Scipy
1414
* Numpy
1515
* Mathplotlib
1616

1717
All the necessary tools needed to run this program are available through [Anaconda](https://www.anaconda.com/download/).
18-
Choose the operating system you are using, download the Python 2.7 version, and follow the Installation instructions available on their website.
18+
Choose the operating system you are using, download the Python 3 version, and follow the Installation instructions available on their website.
1919

2020
To install and run this program, open a command line and type the following:
2121

22-
``` bash
23-
$ git clone https://www.github.com/conorcaseyc/Photopollution-Calculator
24-
$ cd Photopollution-Calculator
25-
$ python2 Program.py
26-
```
27-
If you are using Python 3, use the following command instead of the final command previously mentioned:
28-
2922
```bash
30-
$ python3 Program_3.py
23+
$ python main.py
3124
```
3225

3326
If you have any problems, please [email me.](mailto:16ccasey@student.kenmarecs.com)

UPDATES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ v1.5.1: Emergency Bug Fix Update
2424
v1.5.2: Small Changes and Fixes
2525
v1.6.0: Errer Update
2626
v2.0.0: BTYSTE Update
27+
v3.0.0: Sky Quality Update

Program_3.py renamed to main.py

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
print("""Photopollution Calculator Copyright (C) 2018 Conor Casey
1+
print("""Photopollution Calculator Copyright (C) 2019 Conor Casey
22
This program comes with ABSOLUTELY NO WARRANTY.
33
This is free software, and you are welcome to redistribute it
44
under certain conditions. For further details, type `license'.
@@ -7,7 +7,7 @@
77
To get a history of the updates released for this program, type "updates"
88
To exit the program, type 'quit'.
99
10-
Current Edition: v2.0.0""")
10+
Current Edition: v3.0.0""")
1111

1212
def main():
1313
#Imports Population Density Data from the Central Statistics Office
@@ -72,37 +72,27 @@ def main():
7272
main()
7373

7474
#Calculation of Light Pollution
75-
lux = 0.03510566 * user_input - 14.32414198
76-
77-
#Get Limerick's Population Density In Order to Understand what the LUX Values Mean
78-
limerick = pd_data[pd_data.Towns.isin(["Limerick City"])]
79-
limerick.reset_index(inplace = True, drop = True)
80-
limerick_pd = float(limerick.PD)
81-
limerick_lux = 0.03510566 * (limerick_pd) - 14.32414198
75+
sqm = -2.51632097e-03 * user_input + 2.07271443e+01
8276

8377
#Understanding LUX Values
84-
calculations = (lux) / (limerick_lux) * 100
8578
def conditions():
86-
if calculations >= 80:
87-
return " Terrible Stargazing Conditions"
88-
elif calculations >= 60:
89-
return " Poor Stargazing Conditions"
90-
elif calculations >= 40:
91-
return " Fair Stargazing Conditions"
92-
elif calculations >= 20:
79+
if sqm > 21:
80+
return " Excellent Stargazing Conditions"
81+
elif sqm > 20:
82+
return " Great Stargazing Conditions"
83+
elif sqm > 19:
9384
return " Good Stargazing Conditions"
94-
elif calculations >= 0:
95-
return " Excellent Stargazing Conditions"
85+
elif sqm > 18:
86+
return " Fair Stargazing Conditions"
87+
elif sqm > 17:
88+
return " Poor Stargazing Conditions"
89+
elif sqm < 17:
90+
return " Terrible Stargazing Conditions"
9691

9792
#Result/Output
98-
if calculations >= 0:
99-
print("""
100-
Photopollution in this location is approximately """ + str(int(math.ceil(lux))) + " LUX, this should" + """
93+
print("""
94+
Photopollution in this location is approximately """ + str(round(sqm, 2)) + " mags / arcsec^2, this should" + """
10195
correlate to""" + conditions())
102-
elif calculations < 0:
103-
print("""
104-
Oops, it appears we are getting a negative LUX value. Your population density
105-
is extremely low, therefore, this correlates to Excellent Stargazing Conditions.""")
10696

10797
#Restarts Program
10898
restart = input("""
@@ -115,4 +105,4 @@ def conditions():
115105
quit()
116106
main()
117107

118-
#End of Code
108+
#End of Code

0 commit comments

Comments
 (0)