def understand(image_file): size, header = FormatSMVADSC.get_smv_header(image_file) if header.get("DETECTOR_SN") == "falcon3": return True return False
def understand(image_file): size, header = FormatSMVADSC.get_smv_header(image_file) if header.get("BEAMLINE") == "CETAD_TUI": return True return False
def understand(image_file): '''Check to see if this has the correct dimensions of a pilatus''' size, header = FormatSMVADSC.get_smv_header(image_file) if int(header['SIZE1']) == 2463 and int(header['SIZE2']) == 2527: return True return False
def understand(image_file): """Check to see if this has the correct dimensions of a pilatus""" size, header = FormatSMVADSC.get_smv_header(image_file) if int(header["SIZE1"]) == 2463 and int(header["SIZE2"]) == 2527: return True return False
def understand(image_file): size, header = FormatSMVADSC.get_smv_header(image_file) unwanted_header_items = ["TIME", "DATE"] for header_item in unwanted_header_items: if header_item in header: return False return True
def understand(image_file): size, header = FormatSMVADSC.get_smv_header(image_file) unwanted_header_items = ['TIME','DATE'] for header_item in unwanted_header_items: if header_item in header: return False return True
def understand(image_file): # The header must include a DATE and an integer-valued DETECTOR_SN # for this format to apply. size, header = FormatSMVADSC.get_smv_header(image_file) if 'DATE' not in header.keys(): return False try: int(header['DETECTOR_SN']) except (KeyError, ValueError): return False return True
def understand(image_file): size, header = FormatSMVADSC.get_smv_header(image_file) # Not much to go on with these headers. Check we have exactly the keys # expected and no others if sorted(header.keys()) != [ "BEAM_CENTER_X", "BEAM_CENTER_Y", "BIN", "BYTE_ORDER", "DATE", "DETECTOR_SN", "DIM", "DISTANCE", "HEADER_BYTES", "OSC_RANGE", "OSC_START", "PHI", "PIXEL_SIZE", "SIZE1", "SIZE2", "TIME", "TWOTHETA", "TYPE", "WAVELENGTH", ]: return False # Check a few values are as expected if header.get("DETECTOR_SN") != "unknown": return False if header.get("BIN") != "2x2": return False if header.get("BYTE_ORDER") != "little_endian": return False if header.get("HEADER_BYTES") != "512": return False if header.get("PIXEL_SIZE") != "0.0311999992": return False if header.get("SIZE1") != "2048": return False if header.get("SIZE2") != "2048": return False if header.get("TYPE") != "unsigned_short": return False return True
def understand(image_file): # assert for this that the image file has to be a file not a URL if not os.path.exists(image_file): return False size, header = FormatSMVADSC.get_smv_header(image_file) wanted_header_items = ["TIME"] if any(item not in header for item in wanted_header_items): return False unwanted_header_items = ["DATE"] if any(item in header for item in unwanted_header_items): return False return True
def understand(image_file): # assert for this that the image file has to be a file not a URL import os if not os.path.exists(image_file): return False size, header = FormatSMVADSC.get_smv_header(image_file) wanted_header_items = ['TIME'] for header_item in wanted_header_items: if not header_item in header: return False unwanted_header_items = ['DATE'] for header_item in unwanted_header_items: if header_item in header: return False return True