def display( B=None, A=None, G=None, D=None, F=None ): """Compute and display results. Note that partial results are possible. :param F: Aperture, ƒ/ :param G: Guide number in feet :param A: Film speed, ISO :param B: Beam Candle Power Seconds :param D: Subject distance in feet """ results= elflash.flash( B=B, A=A, G=G, D=D, F=F ) results.D_m= METRE.from_std( FOOT.to_std( results.D ) ) if results.F is not None: if abs(results.F-int(results.F)) > .01: print( "Aperture ...................... ƒ/{F:<4.1f}".format(**results) ) else: print( "Aperture ...................... ƒ/{F:<4.0f}".format(**results) ) if results.G is not None: results.G_m= METRE.from_std( FOOT.to_std( results.G ) ) print( "Guide Number (metres) ......... {G_m:7.1f}".format(**results) ) print( "Guide Number (feet) ........... {G:7.1f}".format(**results) ) if results.A is not None: print( "Film speed .................ISO {A:5.0f}".format(**results) ) if results.B is not None: print( "Beam Candle Power Seconds ..... {B:5.0f}".format(**results) ) if results.D is not None: print( "Subject distance (metres) ..... {D_m:7.1f}".format(**results) ) print( "Subject distance (feet) ....... {D:7.1f}".format(**results) ) if results.G is not None: f_template_1= "Use ƒ/{F:.<4.1f}...........{D_m:5.1f} m. ({D_f:5.1f} ft.)" f_template_0= "Use ƒ/{F:.<4.0f}...........{D_m:5.1f} m. ({D_f:5.1f} ft.)" for F, D_f in elflash.aperture_iter( results.G ): D_m = convert( D_f, FOOT, METRE ) if abs(F-int(F)) > .01: print( f_template_1.format( D_m=D_m, D_f=D_f, F=F ) ) else: print( f_template_0.format( D_m=D_m, D_f=D_f, F=F ) )
def resonant( self, Y ): """Check resonance for all integer wire lengths "near" Y. "To prevent any resonance cut the guy wire so that no section displays a length in feet that can be evenly divided by 16 or 22" :param Y: is a guy-wire length. :return: True if any integer X "near" Y has X%16 or X%22 """ Y_f = int(FOOT.from_std( Y )) for X in range( int( .95*Y_f+.5 ), int(1.05*Y_f+.5) ): if X%self.r_1 == 0 or X%self.r_2 == 0: return True return False
def solve(find=None): """Gather input values for one of the various scenarios. :param find: The variable we're going to be finding, this must be one of "B", "A", "G", "D" or "F". """ assert find in ( "B", "A", "G", "D", "F" ) if find == 'B' or find == 'D' or find == 'F': B= None else: B= input_float( "ENTER: Beam Candle Power Seconds ..........? " ) if find == 'A' or find == 'D' or find == 'F': A= None else: A= input_float( "ENTER: Film speed ......................ISO? " ) if find == 'G': G= None else: G= input_float( "ENTER: Guide Number (metres)...............? " ) if G is not None: G= FOOT.from_std( METRE.to_std( G ) ) else: G= input_float( "ENTER: Guide Number (feet).................? " ) if find == 'D' or find == 'B' or find == 'A': D= None else: D= input_float( "ENTER: Subject distance (metres) ..........? " ) if D is not None: D= FOOT.from_std( METRE.to_std( D ) ) else: D= input_float( "ENTER: Subject distance (feet) ............? " ) if find == 'F' or find == 'B' or find == 'A': F= None else: F= input_float( "ENTER: Aperture .........................ƒ/? " ) display( B=B, A=A, G=G, D=D, F=F )
def __init__( self, unit=None ): self.unit= unit if unit is not None else FOOT self.space = unit.from_std( FOOT.to_std( 1 ) ) # Spacing. self.r_1 = 16 # Feet self.r_2 = 22 # Feet