def read(self, filename):
if filename is not None:<EOL><INDENT>self.filename = filename<EOL><DEDENT>with open(self.filename, '<STR_LIT:rb>') as ccp4:<EOL><INDENT>h = self.header = self._read_header(ccp4)<EOL>nentries = h['<STR_LIT>'] * h['<STR_LIT>'] * h['<STR_LIT>']<EOL>datafmt = h['<STR_LIT>'] + str(nentries) + self._data_bintype<EOL>a = np.array(struct.unpack(datafmt, ccp4.read(struct.calcsize(datafmt))))<EOL><DEDENT>self.header['<STR_LIT:filename>'] = self.filename<EOL>order = '<STR_LIT:C>' if h['<STR_LIT>'] == '<STR_LIT:z>' else '<STR_LIT:F>'<EOL>self.array = a.reshape(h['<STR_LIT>'], h['<STR_LIT>'], h['<STR_LIT>'], order=order)<EOL>self.delta = self._delta()<EOL>self.origin = np.zeros(<NUM_LIT:3>)<EOL>self.rank = <NUM_LIT:3><EOL>
Populate the instance from the ccp4 file *filename*.