Example #1
0
    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
Example #2
0
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 )