def understand(image_file): """Check to see if this looks like an CBF format image, i.e. we can make sense of it.""" header = FormatCBFFull.get_cbf_header(image_file) for record in header.split("\n"): if "_array_data.header_convention" in record and "PILATUS" in record: return True return False
def understand(image_file): '''Check to see if this looks like an CBF format image, i.e. we can make sense of it.''' header = FormatCBFFull.get_cbf_header(image_file) for record in header.split('\n'): if '_array_data.header_convention' in record and \ 'PILATUS' in record: return True return False
def understand(image_file): '''Check to see if this looks like an CBF format image, i.e. we can make sense of it.''' header = FormatCBFFull.get_cbf_header(image_file) for record in header.split('\n'): if '_array_data.header_convention' in record and \ 'PILATUS' in record: return True return False
def understand(image_file): '''Check to see if this looks like an CBF format image, i.e. we can make sense of it.''' header = FormatCBFFull.get_cbf_header(image_file) recognise = 0 records = header.split('\n') for i, record in enumerate(records): if '_diffrn_measurement.diffrn_id' in record and 'BRUKER' in record: recognise += 1 if '_array_element_size.size' in record: try: size1 = float(records[i + 1].split()[-1]) size2 = float(records[i + 2].split()[-1]) except ValueError: return False if size1 == 0.000135 and size2 == 0.000135: recognise += 1 if recognise == 2: return True return False