diff --git a/thermalPy.py b/thermalPy.py index 5af80fe..dde5c7c 100644 --- a/thermalPy.py +++ b/thermalPy.py @@ -1,29 +1,37 @@ # -*- coding: utf-8 -*- import numpy as np import scipy as scp +import time from matplotlib import pyplot as plt -h = 6.63e-34 -c = 2.99792458e8 -k = 1.38e-23 -emiss = .6 -spixel = 0.0000000009 - -cqMax =1.8e5 -cqMin = cqMax*0.1 - -resolution = 10 - -Tmin = 500 -Tmax = 1500 -rangeT = resolution - -Timin = 5 -Timax = 50 -rangeTi = resolution +print(" W e l c o m e t o ") +print(" _ _ _ ___ ") +print(" | |_| |_ ___ _ _ _ __ __ _| | _ \_ _ ") +print(" | _| ' \/ -_) '_| ' \/ _` | | _/ || |") +print(" \__|_||_\___|_| |_|_|_\__,_|_|_| \_, |") +print(" |__/ ") +print("Thermal camera parameters calculation tool") +print("------------------------------------------") +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 +startTime = time.time() #start time to measure execution time # Initialize with zeros donnees = np.zeros((rangeT, rangeTi)) - +prevProgress = 0 # calculate axis xAxis = np.linspace(Tmin, Tmax, rangeT) @@ -1375,19 +1384,26 @@ for T in xAxis: #progress - progress = 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='') + progress = int(round(((x)*rangeTi+y)/(rangeTi*rangeT)*100,0)) - 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 x = x+1 y = 0 - # Plot