def visit_offsets(visitcoef, masks):
    """
    :INPUTS:
       visitcoef : 1D NumPy array
         offsets from unity for each of N HST visits

       masks : 2D NumPy array, N x M
         Set of boolean masks for each of N visits (not orbit!),
         assuming M total observations.

     :NOTES:
       Note that visitcoef[0] will be set so that the quantity
       (1. + visitcoef).prod() always equals unity.
       """
    # 2012-12-21 11:16 IJMC: Created

    nvisits = masks.shape[0]
    visitcoef[0] = 1./(1. + visitcoef[1:]).prod() - 1. # enforce constraint
    mod = (masks * visitcoef.reshape(nvisits, 1)).sum(0)
    #mod = (masks * visitcoef.reshape(nvisits, 1))[masks] # <--- slower!!
    return 1. + mod