def __get_base_layout(self): # The base layout defines which positions might be taken by library # positions. self.add_debug('Fetch base layout ...') converter = LibraryBaseLayoutConverter(self._iso_request.iso_layout, parent=self) self.__base_layout = converter.get_result() if self.__base_layout is None: msg = 'Error when trying to fetch library base layout.' self.add_error(msg) else: self._quadrant_positions = QuadrantIterator.sort_into_sectors( self.__base_layout, number_sectors=NUMBER_SECTORS)
def __get_base_layout(self): # The base layout defines which positions might be taken by library # positions. self.add_debug('Fetch base layout ...') converter = LibraryBaseLayoutConverter( self._iso_request.iso_layout, parent=self) self.__base_layout = converter.get_result() if self.__base_layout is None: msg = 'Error when trying to fetch library base layout.' self.add_error(msg) else: self._quadrant_positions = QuadrantIterator.sort_into_sectors( self.__base_layout, number_sectors=NUMBER_SECTORS)
def __sort_into_sectors(self): # Create a rack layout for each quadrant. self.add_debug('Sort positions into sectors ...') quadrant_positions = QuadrantIterator.sort_into_sectors( self.base_layout, NUMBER_SECTORS) rack_shape_96 = get_96_rack_shape() for sector_index, positions in quadrant_positions.iteritems(): if len(positions) < 1: continue base_layout = LibraryBaseLayout(shape=rack_shape_96) for pos in positions: base_layout.add_position(pos) if len(base_layout) > 0: self.__quadrant_layouts[sector_index] = base_layout if len(self.__quadrant_layouts) < NUMBER_SECTORS: missing_sectors = [] for sector_index in range(NUMBER_SECTORS): if not self.__quadrant_layouts.has_key(sector_index): missing_sectors.append(str(sector_index + 1)) msg = 'Some rack sectors are empty. You do not require stock ' \ 'racks for them: %s!' % (', '.join(missing_sectors)) self.add_warning(msg)
def __get_library_layout(self): """ Fetches the library layout and sorts its positions into quadrants. """ self.add_debug('Fetch library layout ...') converter = LibraryLayoutConverter( self.stock_sample_creation_iso.rack_layout, parent=self) self.__library_layout = converter.get_result() if self.__library_layout is None: msg = 'Error when trying to convert library layout.' self.add_error(msg) else: self.__library_sectors = QuadrantIterator.sort_into_sectors( working_layout=self.__library_layout, number_sectors=NUMBER_SECTORS) del_sectors = [] for sector_index, positions in self.__library_sectors.iteritems(): if len(positions) < 1: del_sectors.append(sector_index) for sector_index in del_sectors: del self.__library_sectors[sector_index]
def _sector_positions(self): if self.__sector_positions is None: self.__sector_positions = \ QuadrantIterator.sort_into_sectors(self._base_layout, NUMBER_SECTORS) return self.__sector_positions