In [3]:
def fire_calc(speed, dpi):
'''
Calculates the fire period and frequency
e.g.
speed = 0.5 # m/s
dpi = 600 # dpi
'''
inch2mm = 25.4 # mm/inch
speed_mm_s = speed*1000 # mm/s
pixel_pitch = (inch2mm/dpi) # mm
fire_freq = speed_mm_s/pixel_pitch # Hz
fire_period = 1/fire_freq
print("Calculating Fire Frequency / Time")
print("----------------------------------")
print("Speed = {} m/s".format(speed))
print("DPI = {}".format(dpi))
print("----------------------------------")
print("Pixel Pitch = {:>5.3} mm = {:>5.4} um".format(pixel_pitch, pixel_pitch*1000))
print("Fire Period = {:>5.2} s = {:>5.3} ms = {} us".format(fire_period, fire_period*1000, fire_period*1000*1000))
print("Fire Frequency = {:>5.2} Hz = {:>5.4} kHz = {} MHz".format(fire_freq, fire_freq/1000, fire_freq/(1000*1000)))
In [4]:
speed = 0.5 # m/s
dpi = 600 # dpi
fire_calc(speed, dpi)