comparison general.py @ 68:ba5866d0251d draft

"planemo upload for repository https://github.com/rolfverberg/galaxytools commit 3fde3e85030608a8a4d8e59308353b0144314dfe"
author rv43
date Fri, 19 Aug 2022 20:16:56 +0000
parents f31ef7bfb430
children fba792d5f83b
comparison
equal deleted inserted replaced
67:87a4acead65c 68:ba5866d0251d
737 else: 737 else:
738 name = ' ' 738 name = ' '
739 # Find available index range 739 # Find available index range
740 if filetype == 'tif': 740 if filetype == 'tif':
741 if not isinstance(path, str) or not os.path.isdir(path): 741 if not isinstance(path, str) or not os.path.isdir(path):
742 illegal_value(path, 'path', 'findImageRange') 742 illegal_value(path, 'path', 'findImageFiles')
743 return -1, 0, [] 743 return -1, 0, []
744 indexRegex = re.compile(r'\d+') 744 indexRegex = re.compile(r'\d+')
745 # At this point only tiffs 745 # At this point only tiffs
746 files = sorted([f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and 746 files = sorted([f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and
747 f.endswith('.tif') and indexRegex.search(f)]) 747 f.endswith('.tif') and indexRegex.search(f)])
760 logging.error('Non-consecutive set of indices for'+name+'images') 760 logging.error('Non-consecutive set of indices for'+name+'images')
761 return -1, 0, [] 761 return -1, 0, []
762 paths = [os.path.join(path, f) for f in files] 762 paths = [os.path.join(path, f) for f in files]
763 elif filetype == 'h5': 763 elif filetype == 'h5':
764 if not isinstance(path, str) or not os.path.isfile(path): 764 if not isinstance(path, str) or not os.path.isfile(path):
765 illegal_value(path, 'path', 'findImageRange') 765 illegal_value(path, 'path', 'findImageFiles')
766 return -1, 0, [] 766 return -1, 0, []
767 # At this point only h5 in alamo2 detector style 767 # At this point only h5 in alamo2 detector style
768 first_index = 0 768 first_index = 0
769 with h5py.File(path, 'r') as f: 769 with h5py.File(path, 'r') as f:
770 num_imgs = f['entry/instrument/detector/data'].shape[0] 770 num_imgs = f['entry/instrument/detector/data'].shape[0]
771 last_index = num_imgs-1 771 last_index = num_imgs-1
772 paths = [path] 772 paths = [path]
773 else: 773 else:
774 illegal_value(filetype, 'filetype', 'findImageRange') 774 illegal_value(filetype, 'filetype', 'findImageFiles')
775 return -1, 0, [] 775 return -1, 0, []
776 logging.debug('\nNumber of available'+name+f'images: {num_imgs}') 776 logging.debug('\nNumber of available'+name+f'images: {num_imgs}')
777 logging.debug('Index range of available'+name+f'images: [{first_index}, '+ 777 logging.debug('Index range of available'+name+f'images: [{first_index}, '+
778 f'{last_index}]') 778 f'{last_index}]')
779 779