ui improvements
- welcome message - user input for variables w/ default value - progress tracking with time & %
This commit is contained in:
parent
b373d223e5
commit
fe1558bb5e
1 changed files with 43 additions and 27 deletions
70
thermalPy.py
70
thermalPy.py
|
@ -1,29 +1,37 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy as scp
|
import scipy as scp
|
||||||
|
import time
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
h = 6.63e-34
|
print(" W e l c o m e t o ")
|
||||||
c = 2.99792458e8
|
print(" _ _ _ ___ ")
|
||||||
k = 1.38e-23
|
print(" | |_| |_ ___ _ _ _ __ __ _| | _ \_ _ ")
|
||||||
emiss = .6
|
print(" | _| ' \/ -_) '_| ' \/ _` | | _/ || |")
|
||||||
spixel = 0.0000000009
|
print(" \__|_||_\___|_| |_|_|_\__,_|_|_| \_, |")
|
||||||
|
print(" |__/ ")
|
||||||
cqMax =1.8e5
|
print("Thermal camera parameters calculation tool")
|
||||||
cqMin = cqMax*0.1
|
print("------------------------------------------")
|
||||||
|
|
||||||
resolution = 10
|
|
||||||
|
|
||||||
Tmin = 500
|
|
||||||
Tmax = 1500
|
|
||||||
rangeT = resolution
|
|
||||||
|
|
||||||
Timin = 5
|
|
||||||
Timax = 50
|
|
||||||
rangeTi = resolution
|
|
||||||
|
|
||||||
|
|
||||||
|
print("Please input parameters (leave empty for default value)")
|
||||||
|
h = float(input("h (default = 6.63e-34): ") or 6.63e-34)
|
||||||
|
c = float(input("c (m/s) (default = 2.99792458e8): ") or 2.99792458e8)
|
||||||
|
k = float(input("h (default = 1.38e-23): ") or 1.38e-23)
|
||||||
|
emiss = float(input("epsilon (default = 0.6): ") or 0.6)
|
||||||
|
spixel = float(input("pixel surface (m^2)( default = 0.9e-9): ") or 0.9e-9)
|
||||||
|
resolution = int(input("graph resolution (number of datapoints) (default = 100): ") or 100)
|
||||||
|
rangeT = int(round(np.sqrt(resolution),0))
|
||||||
|
rangeTi = int(round(np.sqrt(resolution),0))
|
||||||
|
|
||||||
|
cqMax = float(input("camera max cq (default = 1.8e5): ") or 1.8e5)
|
||||||
|
cqMin = float(input("pixel surface (default = 10% of cqMax): ") or cqMax*0.1)
|
||||||
|
|
||||||
|
Tmin = float(input("min temp° (°C) (default = 500): ") or 500)
|
||||||
|
Tmax = float(input("max temp° (°C) (default = 1500): ") or 1500)
|
||||||
|
Timin = float(input("min exposure time (µs) (default = 5): ") or 5)
|
||||||
|
Timax = float(input("max exposure time (µs) (default = 50): ") or 50)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1356,10 +1364,11 @@ def cq(T, Ti, N): #T en kelvin
|
||||||
|
|
||||||
## Resolution
|
## Resolution
|
||||||
|
|
||||||
|
startTime = time.time() #start time to measure execution time
|
||||||
|
|
||||||
# Initialize with zeros
|
# Initialize with zeros
|
||||||
donnees = np.zeros((rangeT, rangeTi))
|
donnees = np.zeros((rangeT, rangeTi))
|
||||||
|
prevProgress = 0
|
||||||
|
|
||||||
# calculate axis
|
# calculate axis
|
||||||
xAxis = np.linspace(Tmin, Tmax, rangeT)
|
xAxis = np.linspace(Tmin, Tmax, rangeT)
|
||||||
|
@ -1375,20 +1384,27 @@ for T in xAxis:
|
||||||
|
|
||||||
|
|
||||||
#progress
|
#progress
|
||||||
progress = round(((x)*rangeTi+y)/(rangeTi*rangeT)*100,0)
|
progress = int(round(((x)*rangeTi+y)/(rangeTi*rangeT)*100,0))
|
||||||
print("Progress : ", progress, "% ", end='')
|
|
||||||
for z in range(int(progress/3)):
|
|
||||||
print("#", end='')
|
|
||||||
for zz in range(33-int(progress/3)):
|
|
||||||
print("-", end='')
|
|
||||||
|
|
||||||
print("")
|
if(progress != prevProgress):
|
||||||
|
|
||||||
|
calcDuration = time.time() - startTime
|
||||||
|
remainingTime = (100-progress)*(calcDuration/(progress+1))
|
||||||
|
|
||||||
|
print("Time : ", int(calcDuration), "s | Remaining : ", int(remainingTime), "s | Progress : ", progress, "% ", end='')
|
||||||
|
|
||||||
|
for z in range(int(progress/3)):
|
||||||
|
print("#", end='')
|
||||||
|
for zz in range(33-int(progress/3)):
|
||||||
|
print("-", end='')
|
||||||
|
|
||||||
|
print("")
|
||||||
|
prevProgress = progress
|
||||||
|
|
||||||
y = y+1
|
y = y+1
|
||||||
x = x+1
|
x = x+1
|
||||||
y = 0
|
y = 0
|
||||||
|
|
||||||
|
|
||||||
# Plot
|
# Plot
|
||||||
|
|
||||||
## Specify contour levels
|
## Specify contour levels
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue