idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
9,100 | def load_labware_by_name ( self , labware_name : str , location : types . DeckLocation , label : str = None ) -> Labware : labware = load ( labware_name , self . _deck_layout . position_for ( location ) , label ) return self . load_labware ( labware , location ) | A convenience function to specify a piece of labware by name . |
9,101 | def load_instrument ( self , instrument_name : str , mount : Union [ types . Mount , str ] , tip_racks : List [ Labware ] = None , replace : bool = False ) -> 'InstrumentContext' : if isinstance ( mount , str ) : try : checked_mount = types . Mount [ mount . upper ( ) ] except KeyError : raise ValueError ( "If mount is... | Load a specific instrument required by the protocol . |
9,102 | def loaded_instruments ( self ) -> Dict [ str , Optional [ 'InstrumentContext' ] ] : return { mount . name . lower ( ) : instr for mount , instr in self . _instruments . items ( ) } | Get the instruments that have been loaded into the protocol . |
9,103 | def delay ( self , seconds = 0 , minutes = 0 , msg = None ) : delay_time = seconds + minutes * 60 self . _hw_manager . hardware . delay ( delay_time ) | Delay protocol execution for a specific amount of time . |
9,104 | def home ( self ) : self . _log . debug ( "home" ) self . _location_cache = None self . _hw_manager . hardware . home ( ) | Homes the robot . |
9,105 | def blow_out ( self , location : Union [ types . Location , Well ] = None ) -> 'InstrumentContext' : if location is None : if not self . _ctx . location_cache : raise RuntimeError ( 'No valid current location cache present' ) else : location = self . _ctx . location_cache . labware if isinstance ( location , Well ) : i... | Blow liquid out of the tip . |
9,106 | def touch_tip ( self , location : Well = None , radius : float = 1.0 , v_offset : float = - 1.0 , speed : float = 60.0 ) -> 'InstrumentContext' : if not self . hw_pipette [ 'has_tip' ] : raise hc . NoTipAttachedError ( 'Pipette has no tip to touch_tip()' ) if speed > 80.0 : self . _log . warning ( 'Touch tip speed abov... | Touch the pipette tip to the sides of a well with the intent of removing left - over droplets |
9,107 | def air_gap ( self , volume : float = None , height : float = None ) -> 'InstrumentContext' : if not self . hw_pipette [ 'has_tip' ] : raise hc . NoTipAttachedError ( 'Pipette has no tip. Aborting air_gap' ) if height is None : height = 5 loc = self . _ctx . location_cache if not loc or not isinstance ( loc . labware ,... | Pull air into the pipette current tip at the current location |
9,108 | def return_tip ( self ) -> 'InstrumentContext' : if not self . hw_pipette [ 'has_tip' ] : self . _log . warning ( 'Pipette has no tip to return' ) loc = self . _last_tip_picked_up_from if not isinstance ( loc , Well ) : raise TypeError ( 'Last tip location should be a Well but it is: ' '{}' . format ( loc ) ) bot = loc... | If a tip is currently attached to the pipette then it will return the tip to it s location in the tiprack . |
9,109 | def pick_up_tip ( self , location : Union [ types . Location , Well ] = None , presses : int = 3 , increment : float = 1.0 ) -> 'InstrumentContext' : num_channels = self . channels def _select_tiprack_from_list ( tip_racks ) -> Tuple [ Labware , Well ] : try : tr = tip_racks [ 0 ] except IndexError : raise OutOfTipsErr... | Pick up a tip for the pipette to run liquid - handling commands with |
9,110 | def drop_tip ( self , location : Union [ types . Location , Well ] = None ) -> 'InstrumentContext' : if location and isinstance ( location , types . Location ) : if isinstance ( location . labware , Well ) : target = location else : raise TypeError ( "If a location is specified as a types.Location (for " "instance, as ... | Drop the current tip . |
9,111 | def home ( self ) -> 'InstrumentContext' : def home_dummy ( mount ) : pass cmds . do_publish ( self . broker , cmds . home , home_dummy , 'before' , None , None , self . _mount . name . lower ( ) ) self . _hw_manager . hardware . home_z ( self . _mount ) self . _hw_manager . hardware . home_plunger ( self . _mount ) cm... | Home the robot . |
9,112 | def distribute ( self , volume : float , source : Well , dest : List [ Well ] , * args , ** kwargs ) -> 'InstrumentContext' : self . _log . debug ( "Distributing {} from {} to {}" . format ( volume , source , dest ) ) kwargs [ 'mode' ] = 'distribute' kwargs [ 'disposal_volume' ] = kwargs . get ( 'disposal_vol' , self .... | Move a volume of liquid from one source to multiple destinations . |
9,113 | def move_to ( self , location : types . Location , force_direct : bool = False , minimum_z_height : float = None ) -> 'InstrumentContext' : if self . _ctx . location_cache : from_lw = self . _ctx . location_cache . labware else : from_lw = None from_center = 'centerMultichannelOnWells' in quirks_from_any_parent ( from_... | Move the instrument . |
9,114 | def type ( self ) -> str : model = self . name if 'single' in model : return 'single' elif 'multi' in model : return 'multi' else : raise RuntimeError ( "Bad pipette model name: {}" . format ( model ) ) | One of single or multi . |
9,115 | def hw_pipette ( self ) -> Dict [ str , Any ] : pipette = self . _hw_manager . hardware . attached_instruments [ self . _mount ] if pipette is None : raise types . PipetteNotAttachedError return pipette | View the information returned by the hardware API directly . |
9,116 | def load_labware ( self , labware : Labware ) -> Labware : if labware . magdeck_engage_height is None : MODULE_LOG . warning ( "This labware ({}) is not explicitly compatible with the" " Magnetic Module. You will have to specify a height when" " calling engage()." ) return super ( ) . load_labware ( labware ) | Load labware onto a Magnetic Module checking if it is compatible |
9,117 | def engage ( self , height : float = None , offset : float = None ) : if height : dist = height elif self . labware and self . labware . magdeck_engage_height is not None : dist = self . labware . magdeck_engage_height if offset : dist += offset else : raise ValueError ( "Currently loaded labware {} does not have a kno... | Raise the Magnetic Module s magnets . |
9,118 | def open ( self ) : self . _geometry . lid_status = self . _module . open ( ) self . _ctx . deck . recalculate_high_z ( ) return self . _geometry . lid_status | Opens the lid |
9,119 | def close ( self ) : self . _geometry . lid_status = self . _module . close ( ) self . _ctx . deck . recalculate_high_z ( ) return self . _geometry . lid_status | Closes the lid |
9,120 | def set_temperature ( self , temp : float , hold_time : float = None , ramp_rate : float = None ) : return self . _module . set_temperature ( temp = temp , hold_time = hold_time , ramp_rate = ramp_rate ) | Set the target temperature in C . |
9,121 | async def _port_poll ( is_old_bootloader , ports_before_switch = None ) : new_port = '' while not new_port : if is_old_bootloader : new_port = await _port_on_mode_switch ( ports_before_switch ) else : ports = await _discover_ports ( ) if ports : discovered_ports = list ( filter ( lambda x : x . endswith ( 'bootloader' ... | Checks for the bootloader port |
9,122 | def critical_point ( self , cp_override : CriticalPoint = None ) -> Point : if not self . has_tip or cp_override == CriticalPoint . NOZZLE : cp_type = CriticalPoint . NOZZLE tip_length = 0.0 else : cp_type = CriticalPoint . TIP tip_length = self . current_tip_length if cp_override == CriticalPoint . XY_CENTER : mod_off... | The vector from the pipette s origin to its critical point . The critical point for a pipette is the end of the nozzle if no tip is attached or the end of the tip if a tip is attached . |
9,123 | def connect_to_robot ( ) : print ( ) import optparse from opentrons import robot print ( 'Connecting to robot...' ) parser = optparse . OptionParser ( usage = 'usage: %prog [options] ' ) parser . add_option ( "-p" , "--p" , dest = "port" , default = '' , type = 'str' , help = 'serial port of the smoothie' ) options , _... | Connect over Serial to the Smoothieware motor driver |
9,124 | def write_identifiers ( robot , mount , new_id , new_model ) : robot . _driver . write_pipette_id ( mount , new_id ) read_id = robot . _driver . read_pipette_id ( mount ) _assert_the_same ( new_id , read_id ) robot . _driver . write_pipette_model ( mount , new_model ) read_model = robot . _driver . read_pipette_model (... | Send a bytearray to the specified mount so that Smoothieware can save the bytes to the pipette s memory |
9,125 | def _user_submitted_barcode ( max_length ) : barcode = input ( 'BUTTON + SCAN: ' ) . strip ( ) if len ( barcode ) > max_length : raise Exception ( BAD_BARCODE_MESSAGE . format ( barcode ) ) barcode = barcode [ barcode . index ( 'P' ) : ] barcode = barcode . split ( '\r' ) [ 0 ] . split ( '\n' ) [ 0 ] return barcode | User can enter a serial number as a string of HEX values Length of byte array must equal num |
9,126 | def set_mounted ( unitname : str , mounted : bool , swallow_exc : bool = False ) : try : if mounted : LOG . info ( f"Starting {unitname}" ) interface ( ) . StartUnit ( unitname , 'replace' ) LOG . info ( f"Started {unitname}" ) else : LOG . info ( f"Stopping {unitname}" ) interface ( ) . StopUnit ( unitname , 'replace'... | Mount or unmount a unit . |
9,127 | def require_session ( handler ) : @ functools . wraps ( handler ) async def decorated ( request : web . Request ) -> web . Response : request_session_token = request . match_info [ 'session' ] session = session_from_request ( request ) if not session or request_session_token != session . token : LOG . warning ( f"reque... | Decorator to ensure a session is properly in the request |
9,128 | def get_version ( path ) -> str : if path and os . path . exists ( path ) : with open ( path ) as pkg : package_dict = json . load ( pkg ) version = package_dict . get ( 'version' ) else : version = 'not available' return version | Reads the version field from a package file |
9,129 | def calculate_tip_probe_hotspots ( tip_length : float , tip_probe_settings : tip_probe_config ) -> List [ HotSpot ] : size_x , size_y , size_z = tip_probe_settings . dimensions rel_x_start = ( size_x / 2 ) + tip_probe_settings . switch_clearance rel_y_start = ( size_y / 2 ) + tip_probe_settings . switch_clearance nozzl... | Generate a list of tuples describing motions for doing the xy part of tip probe based on the config s description of the tip probe box . |
9,130 | def init ( loop = None , hardware : 'HardwareAPILike' = None ) : app = web . Application ( loop = loop , middlewares = [ error_middleware ] ) if hardware : checked_hardware = hardware else : checked_hardware = opentrons . hardware app [ 'com.opentrons.hardware' ] = checked_hardware app [ 'com.opentrons.rpc' ] = RPCServ... | Builds an application and sets up RPC and HTTP servers with it . |
9,131 | def run ( hostname = None , port = None , path = None , loop = None ) : if path : log . debug ( "Starting Opentrons server application on {}" . format ( path ) ) hostname , port = None , None else : log . debug ( "Starting Opentrons server application on {}:{}" . format ( hostname , port ) ) path = None web . run_app (... | The arguments are not all optional . Either a path or hostname + port should be specified ; you have to specify one . |
9,132 | def discover ( ) -> List [ Tuple [ str , str ] ] : if IS_ROBOT and os . path . isdir ( '/dev/modules' ) : devices = os . listdir ( '/dev/modules' ) else : devices = [ ] discovered_modules = [ ] module_port_regex = re . compile ( '|' . join ( MODULE_TYPES . keys ( ) ) , re . I ) for port in devices : match = module_port... | Scan for connected modules and instantiate handler classes |
9,133 | async def update_firmware ( module : AbstractModule , firmware_file : str , loop : Optional [ asyncio . AbstractEventLoop ] ) -> AbstractModule : simulating = module . is_simulated cls = type ( module ) old_port = module . port flash_port = await module . prep_for_update ( ) callback = module . interrupt_callback del m... | Update a module . |
9,134 | def move ( self , pose_tree , x = None , y = None , z = None , home_flagged_axes = True ) : def defaults ( _x , _y , _z ) : _x = _x if x is not None else 0 _y = _y if y is not None else 0 _z = _z if z is not None else 0 return _x , _y , _z dst_x , dst_y , dst_z = change_base ( pose_tree , src = self . _src , dst = self... | Dispatch move command to the driver changing base of x y and z from source coordinate system to destination . |
9,135 | def validate_update ( filepath : str , progress_callback : Callable [ [ float ] , None ] ) -> Tuple [ str , str ] : filenames = [ ROOTFS_NAME , ROOTFS_HASH_NAME , BOOT_NAME , BOOT_HASH_NAME ] def zip_callback ( progress ) : progress_callback ( progress / 3.0 ) files , sizes = unzip_update ( filepath , zip_callback , fi... | Like otupdate . buildroot . file_actions . validate_update but moreso |
9,136 | def patch_connection_file_paths ( connection : str ) -> str : new_conn_lines = [ ] for line in connection . split ( '\n' ) : if '=' in line : parts = line . split ( '=' ) path_matches = re . search ( '/mnt/data/resin-data/[0-9]+/(.*)' , parts [ 1 ] ) if path_matches : new_path = f'/data/{path_matches.group(1)}' new_con... | Patch any paths in a connection to remove the balena host paths |
9,137 | def migrate ( ignore : Sequence [ str ] , name : str ) : try : with mount_data_partition ( ) as datamount : migrate_data ( ignore , datamount , DATA_DIR_NAME ) migrate_connections ( datamount ) migrate_hostname ( datamount , name ) except Exception : LOG . exception ( "Exception during data migration" ) raise | Copy everything in the app data to the root of the new partition |
9,138 | def migrate_data ( ignore : Sequence [ str ] , new_data_path : str , old_data_path : str ) : dest_data = os . path . join ( new_data_path , 'data' ) LOG . info ( f"migrate_data: copying {old_data_path} to {dest_data}" ) os . makedirs ( dest_data , exist_ok = True ) with os . scandir ( old_data_path ) as scanner : for e... | Copy everything in the app data to the root of the main data part |
9,139 | def migrate_system_connections ( src_sc : str , dest_sc : str ) -> bool : found = False LOG . info ( f"migrate_system_connections: checking {dest_sc}" ) os . makedirs ( dest_sc , exist_ok = True ) with os . scandir ( src_sc ) as scanner : for entry in scanner : if entry . name . endswith ( '.ignore' ) : continue if ent... | Migrate the contents of a system - connections dir |
9,140 | def migrate_connections ( new_data_path : str ) : dest_connections = os . path . join ( new_data_path , 'lib' , 'NetworkManager' , 'system-connections' ) os . makedirs ( dest_connections , exist_ok = True ) with mount_state_partition ( ) as state_path : src_connections = os . path . join ( state_path , 'root-overlay' ,... | Migrate wifi connection files to new locations and patch them |
9,141 | def migrate_hostname ( dest_data : str , name : str ) : if name . startswith ( 'opentrons-' ) : name = name [ len ( 'opentrons-' ) : ] LOG . info ( f"migrate_hostname: writing name {name} to {dest_data}/hostname," f" {dest_data}/machine-info, {dest_data}/serial" ) with open ( os . path . join ( dest_data , 'hostname' )... | Write the machine name to a couple different places |
9,142 | def infer_config_base_dir ( ) -> Path : if 'OT_API_CONFIG_DIR' in os . environ : return Path ( os . environ [ 'OT_API_CONFIG_DIR' ] ) elif IS_ROBOT : return Path ( '/data' ) else : search = ( Path . cwd ( ) , Path . home ( ) / '.opentrons' ) for path in search : if ( path / _CONFIG_FILENAME ) . exists ( ) : return path... | Return the directory to store data in . |
9,143 | def load_and_migrate ( ) -> Dict [ str , Path ] : if IS_ROBOT : _migrate_robot ( ) base = infer_config_base_dir ( ) base . mkdir ( parents = True , exist_ok = True ) index = _load_with_overrides ( base ) return _ensure_paths_and_types ( index ) | Ensure the settings directory tree is properly configured . |
9,144 | def _load_with_overrides ( base ) -> Dict [ str , str ] : should_write = False overrides = _get_environ_overrides ( ) try : index = json . load ( ( base / _CONFIG_FILENAME ) . open ( ) ) except ( OSError , json . JSONDecodeError ) as e : sys . stderr . write ( "Error loading config from {}: {}\nRewriting...\n" . format... | Load an config or write its defaults |
9,145 | def _ensure_paths_and_types ( index : Dict [ str , str ] ) -> Dict [ str , Path ] : configs_by_name = { ce . name : ce for ce in CONFIG_ELEMENTS } correct_types : Dict [ str , Path ] = { } for key , item in index . items ( ) : if key not in configs_by_name : continue if configs_by_name [ key ] . kind == ConfigElementTy... | Take the direct results of loading the config and make sure the filesystem reflects them . |
9,146 | def _legacy_index ( ) -> Union [ None , Dict [ str , str ] ] : for index in _LEGACY_INDICES : if index . exists ( ) : try : return json . load ( open ( index ) ) except ( OSError , json . JSONDecodeError ) : return None return None | Try and load an index file from the various places it might exist . |
9,147 | def _find_most_recent_backup ( normal_path : Optional [ str ] ) -> Optional [ str ] : if normal_path is None : return None if os . path . exists ( normal_path ) : return normal_path dirname , basename = os . path . split ( normal_path ) root , ext = os . path . splitext ( basename ) backups = [ fi for fi in os . listdi... | Find the most recent old settings to migrate . |
9,148 | def generate_config_index ( defaults : Dict [ str , str ] , base_dir = None ) -> Dict [ str , Path ] : base = Path ( base_dir ) if base_dir else infer_config_base_dir ( ) def parse_or_default ( ce : ConfigElement , val : Optional [ str ] ) -> Path : if not val : return base / Path ( ce . default ) else : return Path ( ... | Determines where existing info can be found in the system and creates a corresponding data dict that can be written to index . json in the baseDataDir . |
9,149 | def write_config ( config_data : Dict [ str , Path ] , path : Path = None ) : path = Path ( path ) if path else infer_config_base_dir ( ) valid_names = [ ce . name for ce in CONFIG_ELEMENTS ] try : os . makedirs ( path , exist_ok = True ) with ( path / _CONFIG_FILENAME ) . open ( 'w' ) as base_f : json . dump ( { k : s... | Save the config file . |
9,150 | def main ( ) : prompt = input ( ">>> Warning! Running this tool backup and clear any previous " "calibration data. Proceed (y/[n])? " ) if prompt not in [ 'y' , 'Y' , 'yes' ] : print ( 'Exiting--prior configuration data not changed' ) sys . exit ( ) cli = CLITool ( point_set = get_calibration_points ( ) , tip_length = ... | A CLI application for performing factory calibration of an Opentrons robot |
9,151 | def increase_step ( self ) -> str : if self . _steps_index < len ( self . _steps ) - 1 : self . _steps_index = self . _steps_index + 1 return 'step: {}' . format ( self . current_step ( ) ) | Increase the jog resolution without overrunning the list of values |
9,152 | def decrease_step ( self ) -> str : if self . _steps_index > 0 : self . _steps_index = self . _steps_index - 1 return 'step: {}' . format ( self . current_step ( ) ) | Decrease the jog resolution without overrunning the list of values |
9,153 | def _jog ( self , axis , direction , step ) : jog ( axis , direction , step , self . hardware , self . _current_mount ) self . current_position = self . _position ( ) return 'Jog: {}' . format ( [ axis , str ( direction ) , str ( step ) ] ) | Move the pipette on axis in direction by step and update the position tracker |
9,154 | def home ( self ) -> str : self . hardware . home ( ) self . current_position = self . _position ( ) return 'Homed' | Return the robot to the home position and update the position tracker |
9,155 | def save_point ( self ) -> str : if self . _current_mount is left : msg = self . save_mount_offset ( ) self . _current_mount = right elif self . _current_mount is types . Mount . LEFT : msg = self . save_mount_offset ( ) self . _current_mount = types . Mount . RIGHT else : pos = self . _position ( ) [ : - 1 ] self . ac... | Indexes the measured data with the current point as a key and saves the current position once the Enter key is pressed to the actual points vector . |
9,156 | def save_transform ( self ) -> str : expected = [ self . _expected_points [ p ] [ : 2 ] for p in [ 1 , 2 , 3 ] ] log . debug ( "save_transform expected: {}" . format ( expected ) ) actual = [ self . actual_points [ p ] [ : 2 ] for p in [ 1 , 2 , 3 ] ] log . debug ( "save_transform actual: {}" . format ( actual ) ) flat... | Actual is measured data Expected is based on mechanical drawings of the robot |
9,157 | def find_config ( prefix : str ) -> str : matches = [ conf for conf in config_models if conf . startswith ( prefix ) ] if not matches : raise KeyError ( 'No match found for prefix {}' . format ( prefix ) ) if prefix in matches : return prefix else : return sorted ( matches ) [ 0 ] | Find the most recent config matching prefix |
9,158 | def get_attached_instruments ( self , expected : Dict [ types . Mount , str ] ) -> Dict [ types . Mount , Dict [ str , Optional [ str ] ] ] : to_return : Dict [ types . Mount , Dict [ str , Optional [ str ] ] ] = { } for mount in types . Mount : expected_instr = expected . get ( mount , None ) init_instr = self . _atta... | Update the internal cache of attached instruments . |
9,159 | def _ensure_programmer_executable ( ) : updater_executable = shutil . which ( 'lpc21isp' , mode = os . F_OK ) os . chmod ( updater_executable , 0o777 ) | Find the lpc21isp executable and ensure it is executable |
9,160 | async def restart ( request ) : def wait_and_restart ( ) : log . info ( 'Restarting server' ) sleep ( 1 ) os . system ( 'kill 1' ) Thread ( target = wait_and_restart ) . start ( ) return web . json_response ( { "message" : "restarting" } ) | Returns OK then waits approximately 1 second and restarts container |
9,161 | def get_app ( system_version_file : str = None , config_file_override : str = None , name_override : str = None , loop : asyncio . AbstractEventLoop = None ) -> web . Application : if not system_version_file : system_version_file = BR_BUILTIN_VERSION_FILE version = get_version ( system_version_file ) name = name_overri... | Build and return the aiohttp . web . Application that runs the server |
9,162 | async def on_shutdown ( self , app ) : for ws in self . clients . copy ( ) : await ws . close ( code = WSCloseCode . GOING_AWAY , message = 'Server shutdown' ) self . shutdown ( ) | Graceful shutdown handler |
9,163 | async def handler ( self , request ) : def task_done ( future ) : self . tasks . remove ( future ) exception = future . exception ( ) if exception : log . warning ( 'While processing message: {0}\nDetails: {1}' . format ( exception , traceback . format_exc ( ) ) ) client = web . WebSocketResponse ( ) client_id = id ( c... | Receives HTTP request and negotiates up to a Websocket session |
9,164 | def resolve_args ( self , args ) : def resolve ( a ) : if isinstance ( a , dict ) : _id = a . get ( 'i' , None ) return self . objects [ _id ] if _id else a [ 'v' ] if isinstance ( a , ( list , tuple ) ) : return [ resolve ( i ) for i in a ] return a return [ resolve ( a ) for a in args ] | Resolve function call arguments that have object ids into instances of these objects |
9,165 | async def build_hardware_controller ( cls , config : robot_configs . robot_config = None , port : str = None , loop : asyncio . AbstractEventLoop = None , force : bool = False ) -> 'API' : if None is Controller : raise RuntimeError ( 'The hardware controller may only be instantiated on a robot' ) checked_loop = loop or... | Build a hardware controller that will actually talk to hardware . |
9,166 | def build_hardware_simulator ( cls , attached_instruments : Dict [ top_types . Mount , Dict [ str , Optional [ str ] ] ] = None , attached_modules : List [ str ] = None , config : robot_configs . robot_config = None , loop : asyncio . AbstractEventLoop = None , strict_attached_instruments : bool = True ) -> 'API' : if ... | Build a simulating hardware controller . |
9,167 | async def register_callback ( self , cb ) : self . _callbacks . add ( cb ) def unregister ( ) : self . _callbacks . remove ( cb ) return unregister | Allows the caller to register a callback and returns a closure that can be used to unregister the provided callback |
9,168 | def set_lights ( self , button : bool = None , rails : bool = None ) : self . _backend . set_lights ( button , rails ) | Control the robot lights . |
9,169 | async def identify ( self , duration_s : int = 5 ) : count = duration_s * 4 on = False for sec in range ( count ) : then = self . _loop . time ( ) self . set_lights ( button = on ) on = not on now = self . _loop . time ( ) await asyncio . sleep ( max ( 0 , 0.25 - ( now - then ) ) ) self . set_lights ( button = True ) | Blink the button light to identify the robot . |
9,170 | async def cache_instruments ( self , require : Dict [ top_types . Mount , str ] = None ) : checked_require = require or { } self . _log . info ( "Updating instrument model cache" ) found = self . _backend . get_attached_instruments ( checked_require ) for mount , instrument_data in found . items ( ) : model = instrumen... | - Get the attached instrument on each mount and - Cache their pipette configs from pipette - config . json |
9,171 | async def update_firmware ( self , firmware_file : str , loop : asyncio . AbstractEventLoop = None , explicit_modeset : bool = True ) -> str : if None is loop : checked_loop = self . _loop else : checked_loop = loop return await self . _backend . update_firmware ( firmware_file , checked_loop , explicit_modeset ) | Update the firmware on the Smoothie board . |
9,172 | async def home_z ( self , mount : top_types . Mount = None ) : if not mount : axes = [ Axis . Z , Axis . A ] else : axes = [ Axis . by_mount ( mount ) ] await self . home ( axes ) | Home the two z - axes |
9,173 | async def home_plunger ( self , mount : top_types . Mount ) : instr = self . _attached_instruments [ mount ] if instr : await self . home ( [ Axis . of_plunger ( mount ) ] ) await self . _move_plunger ( mount , instr . config . bottom ) | Home the plunger motor for a mount and then return it to the bottom position . |
9,174 | def _deck_from_smoothie ( self , smoothie_pos : Dict [ str , float ] ) -> Dict [ Axis , float ] : with_enum = { Axis [ k ] : v for k , v in smoothie_pos . items ( ) } plunger_axes = { k : v for k , v in with_enum . items ( ) if k not in Axis . gantry_axes ( ) } right = ( with_enum [ Axis . X ] , with_enum [ Axis . Y ] ... | Build a deck - abs position store from the smoothie s position |
9,175 | async def gantry_position ( self , mount : top_types . Mount , critical_point : CriticalPoint = None ) -> top_types . Point : cur_pos = await self . current_position ( mount , critical_point ) return top_types . Point ( x = cur_pos [ Axis . X ] , y = cur_pos [ Axis . Y ] , z = cur_pos [ Axis . by_mount ( mount ) ] ) | Return the position of the critical point as pertains to the gantry |
9,176 | async def move_to ( self , mount : top_types . Mount , abs_position : top_types . Point , speed : float = None , critical_point : CriticalPoint = None ) : if not self . _current_position : raise MustHomeError await self . _cache_and_maybe_retract_mount ( mount ) z_axis = Axis . by_mount ( mount ) if mount == top_types ... | Move the critical point of the specified mount to a location relative to the deck at the specified speed . speed sets the speed of all robot axes to the given value . So if multiple axes are to be moved they will do so at the same speed |
9,177 | async def move_rel ( self , mount : top_types . Mount , delta : top_types . Point , speed : float = None ) : if not self . _current_position : raise MustHomeError await self . _cache_and_maybe_retract_mount ( mount ) z_axis = Axis . by_mount ( mount ) try : target_position = OrderedDict ( ( ( Axis . X , self . _current... | Move the critical point of the specified mount by a specified displacement in a specified direction at the specified speed . speed sets the speed of all axes to the given value . So if multiple axes are to be moved they will do so at the same speed |
9,178 | async def _cache_and_maybe_retract_mount ( self , mount : top_types . Mount ) : if mount != self . _last_moved_mount and self . _last_moved_mount : await self . retract ( self . _last_moved_mount , 10 ) self . _last_moved_mount = mount | Retract the other mount if necessary |
9,179 | async def _move ( self , target_position : 'OrderedDict[Axis, float]' , speed : float = None , home_flagged_axes : bool = True ) : to_transform = tuple ( ( tp for ax , tp in target_position . items ( ) if ax in Axis . gantry_axes ( ) ) ) smoothie_pos = { ax . name : pos for ax , pos in target_position . items ( ) if ax... | Worker function to apply robot motion . |
9,180 | def engaged_axes ( self ) -> Dict [ Axis , bool ] : return { Axis [ ax ] : eng for ax , eng in self . _backend . engaged_axes ( ) . items ( ) } | Which axes are engaged and holding . |
9,181 | async def retract ( self , mount : top_types . Mount , margin : float ) : smoothie_ax = Axis . by_mount ( mount ) . name . upper ( ) async with self . _motion_lock : smoothie_pos = self . _backend . fast_home ( smoothie_ax , margin ) self . _current_position = self . _deck_from_smoothie ( smoothie_pos ) | Pull the specified mount up to its home position . |
9,182 | def _critical_point_for ( self , mount : top_types . Mount , cp_override : CriticalPoint = None ) -> top_types . Point : pip = self . _attached_instruments [ mount ] if pip is not None and cp_override != CriticalPoint . MOUNT : return pip . critical_point ( cp_override ) else : return top_types . Point ( 0 , 0 , 0 ) | Return the current critical point of the specified mount . |
9,183 | async def blow_out ( self , mount ) : this_pipette = self . _attached_instruments [ mount ] if not this_pipette : raise top_types . PipetteNotAttachedError ( "No pipette attached to {} mount" . format ( mount . name ) ) self . _backend . set_active_current ( Axis . of_plunger ( mount ) , this_pipette . config . plunger... | Force any remaining liquid to dispense . The liquid will be dispensed at the current location of pipette |
9,184 | async def pick_up_tip ( self , mount , tip_length : float , presses : int = None , increment : float = None ) : instr = self . _attached_instruments [ mount ] assert instr assert not instr . has_tip , 'Tip already attached' instr_ax = Axis . by_mount ( mount ) plunger_ax = Axis . of_plunger ( mount ) self . _log . info... | Pick up tip from current location . |
9,185 | async def drop_tip ( self , mount , home_after = True ) : instr = self . _attached_instruments [ mount ] assert instr assert instr . has_tip , 'Cannot drop tip without a tip attached' self . _log . info ( "Dropping tip off from {}" . format ( instr . name ) ) plunger_ax = Axis . of_plunger ( mount ) droptip = instr . c... | Drop tip at the current location |
9,186 | async def update_module ( self , module : modules . AbstractModule , firmware_file : str , loop : asyncio . AbstractEventLoop = None ) -> Tuple [ bool , str ] : details = ( module . port , module . name ( ) ) mod = self . _attached_modules . pop ( details [ 0 ] + details [ 1 ] ) try : new_mod = await self . _backend . ... | Update a module s firmware . |
9,187 | def update_instrument_offset ( self , mount , new_offset : top_types . Point = None , from_tip_probe : top_types . Point = None ) : if from_tip_probe : new_offset = ( top_types . Point ( * self . _config . tip_probe . center ) - from_tip_probe ) elif not new_offset : raise ValueError ( "Either from_tip_probe or new_off... | Update the instrument offset for a pipette on the specified mount . |
9,188 | def load ( pipette_model : str , pipette_id : str = None ) -> pipette_config : cfg = copy . deepcopy ( configs [ pipette_model ] ) cfg . update ( copy . deepcopy ( name_config ( ) [ cfg [ 'name' ] ] ) ) if pipette_id : try : override = load_overrides ( pipette_id ) except FileNotFoundError : save_overrides ( pipette_id... | Load pipette config data |
9,189 | def known_pipettes ( ) -> Sequence [ str ] : return [ fi . stem for fi in CONFIG [ 'pipette_config_overrides_dir' ] . iterdir ( ) if fi . is_file ( ) and '.json' in fi . suffixes ] | List pipette IDs for which we have known overrides |
9,190 | def load_config_dict ( pipette_id : str ) -> Dict : override = load_overrides ( pipette_id ) model = override [ 'model' ] config = copy . deepcopy ( model_config ( ) [ 'config' ] [ model ] ) config . update ( copy . deepcopy ( name_config ( ) [ config [ 'name' ] ] ) ) for top_level_key in config . keys ( ) : add_defaul... | Give updated config with overrides for a pipette . This will add the default value for a mutable config before returning the modified config value . |
9,191 | def list_mutable_configs ( pipette_id : str ) -> Dict [ str , Any ] : cfg : Dict [ str , Any ] = { } if pipette_id in known_pipettes ( ) : config = load_config_dict ( pipette_id ) else : log . info ( 'Pipette id {} not found' . format ( pipette_id ) ) return cfg for key in config : if key in mutable_configs : cfg [ key... | Returns dict of mutable configs only . |
9,192 | def probe_plate ( self ) -> str : self . run_flag . wait ( ) try : self . _send_command ( GCODES [ 'PROBE_PLATE' ] ) except ( MagDeckError , SerialException , SerialNoResponse ) as e : return str ( e ) return '' | Probes for the deck plate and calculates the plate distance from home . To be used for calibrating MagDeck |
9,193 | def move ( self , position_mm ) -> str : self . run_flag . wait ( ) try : position_mm = round ( float ( position_mm ) , GCODE_ROUNDING_PRECISION ) self . _send_command ( '{0} Z{1}' . format ( GCODES [ 'MOVE' ] , position_mm ) ) except ( MagDeckError , SerialException , SerialNoResponse ) as e : return str ( e ) return ... | Move the magnets along Z axis where the home position is 0 . 0 ; position_mm - > a point along Z . Does not self - check if the position is outside of the deck s linear range |
9,194 | def save_calibration ( labware : Labware , delta : Point ) : calibration_path = CONFIG [ 'labware_calibration_offsets_dir_v4' ] if not calibration_path . exists ( ) : calibration_path . mkdir ( parents = True , exist_ok = True ) labware_offset_path = calibration_path / '{}.json' . format ( labware . _id ) calibration_d... | Function to be used whenever an updated delta is found for the first well of a given labware . If an offset file does not exist create the file using labware id as the filename . If the file does exist load it and modify the delta and the lastModified fields under the default key . |
9,195 | def save_tip_length ( labware : Labware , length : float ) : calibration_path = CONFIG [ 'labware_calibration_offsets_dir_v4' ] if not calibration_path . exists ( ) : calibration_path . mkdir ( parents = True , exist_ok = True ) labware_offset_path = calibration_path / '{}.json' . format ( labware . _id ) calibration_d... | Function to be used whenever an updated tip length is found for of a given tip rack . If an offset file does not exist create the file using labware id as the filename . If the file does exist load it and modify the length and the lastModified fields under the tipLength key . |
9,196 | def load_calibration ( labware : Labware ) : calibration_path = CONFIG [ 'labware_calibration_offsets_dir_v4' ] labware_offset_path = calibration_path / '{}.json' . format ( labware . _id ) if labware_offset_path . exists ( ) : calibration_data = _read_file ( str ( labware_offset_path ) ) offset_array = calibration_dat... | Look up a calibration if it exists and apply it to the given labware . |
9,197 | def load_from_definition ( definition : dict , parent : Location , label : str = None ) -> Labware : labware = Labware ( definition , parent , label ) load_calibration ( labware ) return labware | Return a labware object constructed from a provided labware definition dict |
9,198 | def clear_calibrations ( ) : calibration_path = CONFIG [ 'labware_calibration_offsets_dir_v4' ] try : targets = [ f for f in calibration_path . iterdir ( ) if f . suffix == '.json' ] for target in targets : target . unlink ( ) except FileNotFoundError : pass | Delete all calibration files for labware . This includes deleting tip - length data for tipracks . |
9,199 | def quirks_from_any_parent ( loc : Union [ Labware , Well , str , ModuleGeometry , None ] ) -> List [ str ] : def recursive_get_quirks ( obj , found ) : if isinstance ( obj , Labware ) : return found + obj . quirks elif isinstance ( obj , Well ) : return recursive_get_quirks ( obj . parent , found ) else : return found... | Walk the tree of wells and labwares and extract quirks |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.