Skip to content

Commit 0ac46bc

Browse files
authored
Merge pull request #5 from AxiomYT/Development
Push 1.5.2 - Cleaned up some rough code
2 parents f3f8b37 + 2d62bd8 commit 0ac46bc

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
## To-Do
5555

5656
* ~~Make the calculation work~~
57-
* Unit Test
5857
* ~~Pull from config file~~
5958
* ~~Allow selection of pixel_pitch states~~
60-
* Incorporate Pathlib
59+
* ~~Incorporate Pathlib~~
60+
* Unit Test
6161

6262
<!-- GETTING STARTED -->
6363
## Getting Started

astrophotography.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ def __init__(self):
2323
config = ConfigParser()
2424

2525
# Functions
26-
def main():
27-
setup(config)
28-
printVariables()
29-
npfMethod()
30-
sys.exit()
26+
def main(): # Functionality -
27+
setup(config) # Takes config data, sets into appropriate data structs.
28+
printVariables() # Pretty Prints Variables to be used in calculation.
29+
npfMethod() # Outputs final shutter speed value.
30+
sys.exit() # Wraps-up and exits cleanly.
3131

3232
def setup(config):
33-
try: # Wrapped config.read in a try-except block. #
34-
config.read(configLocation) # This was done to give the user some - #
35-
calculation.pixel_pitch = config.get('Pixel Pitch','PIXEL_PITCH') # explanation as to why it failed to execute. #
33+
try: # Wrapped config.read in a try-except block. #
34+
config.read(configLocation) # This was done to give the user some - #
35+
calculation.pixel_pitch = config.get('Pixel Pitch','PIXEL_PITCH') # explanation as to why it failed to execute. #
3636

3737
calculation.focal_length = (float(config.get('Specific Camera Variables', 'FOCAL_LENGTH')))
3838
calculation.aperture = float(config.get('Specific Camera Variables', 'APERTURE'))
@@ -51,8 +51,9 @@ def setup(config):
5151
raise Exception('Could not open config.cfg, this could be down to a permissions error - \nOr even simply that the file does not exist, please check.\n\nhttps://github.com/AxiomYT/NPF-Rule-Calculator-Python\n\nFor further clarification.\n')
5252

5353
def printVariables():
54-
print('\033[95m' + "\nFocal Length -", int(calculation.focal_length), " Millimetres" + '\033[0m')
55-
print('\033[94m' + "Pixel Pitch -", round(float(calculation.pixel_pitch), 2), "Millimetres" + '\033[0m') # Important that the output is rounded, looks neater. 2x signifigant figures.
54+
# Important that the outputs are rounded, looks neater. 2x signifigant figures. except for aperture, which can only gain from the specificity.
55+
print('\033[95m' + "\nFocal Length -", round(int(calculation.focal_length), 2), " Millimetres" + '\033[0m')
56+
print('\033[94m' + "Pixel Pitch -", round(float(calculation.pixel_pitch), 2), "Millimetres" + '\033[0m')
5657
print('\033[96m' + "Aperture -", calculation.aperture, "\n" + '\033[0m')
5758

5859
def npfMethod():

0 commit comments

Comments
 (0)