def saveBeeFormat(self,filename):
        #maybe check for overwrite? and add param for allowing overwrite
        f = open(filename, "wb")
        
        # write line 1 : file_type and version
        file_type = 'D'
        if self.matrix.dtype == np.byte:    
            file_type = 'M'
        elif self.is_distance:
            file_type = 'D'
        else:
            file_type = 'S'
            
        f.write(file_type)
        f.write("2\x0a")
        
        # write lines 2 and 3 (target and query sigsets)
        f.write(self.target_filename+"\x0a")
        f.write(self.query_filename+"\x0a")
        
        # write line 4 (MF n_queries n_targets magic_number)
        magic_number = struct.pack('=I',0x12345678)
        assert len(magic_number) == 4 # Bug fix: verify the magic number is really 4 bytes
        if file_type == 'M':
            f.write("MB %d %d %s\x0a" %(self.n_queries, self.n_targets, magic_number))
        else:
            f.write("MF %d %d %s\x0a" %(self.n_queries, self.n_targets, magic_number))
        
        # write the data
        f.write(self.matrix)
        f.close()
dataset/ETHPy150Open bolme/pyvision/src/pyvision/analysis/bee.py/BEEDistanceMatrix.saveBeeFormat/original