We show that the phase of a Bose-Einstein condensate wave function of ultracold atoms in an optical lattice potential in two dimensions can be detected. The time-of-flight images, obtained in a free expansion of initially trapped atoms, are related to the initial distribution of atomic momenta but the information on the phase is lost. However, the initial atomic cloud is bounded and this information, in addition to the time-of-flight images, is sufficient in order to employ the phase retrieval algorithms. We analyze the phase retrieval methods for model wave functions in a case of a Bose-Einstein condensate in a triangular optical lattice in the presence of artificial gauge fields.