nanotune.tuningstages.chargediagram_tasks

class nanotune.tuningstages.chargediagram_tasks.DotClassifierOutcome(**kwargs)

Bases: dict

singledot: int
doubledot: int
dotregime: int
nanotune.tuningstages.chargediagram_tasks.segment_dot_data(run_id: int, db_name: str, db_folder: Optional[str] = None, segment_db_name: Optional[str] = None, segment_db_folder: Optional[str] = None, segment_size: float = 0.05) Dict[int, Any][source]

Divides a 2D measurement into segments of segment_size x segment_size in Volt.

Parameters
  • run_id – QCoDeS data run ID.

  • db_name – Name of database containg dataset.

  • db_folder – Path to folder containing db_name.

  • segment_db_name – Name of database where data segments should be saved.

  • segment_db_folder – Path to folder containing segment_db_name.

  • segment_size – Voltage interval the segments should span in each dimension.

Returns

dict – Dictionary mapping run IDs of segmented data to the voltages ranges they span: dot_segments = {<run_id>: {voltage_ranges: [(), ()]}}.

nanotune.tuningstages.chargediagram_tasks.classify_dot_segments(classifiers: Classifiers, run_ids: List[int], db_name: str, db_folder: Optional[str] = None) Dict[int, Dict[str, Union[bool, int]]][source]

Classifies several datasets holding charge diagrams, e.g. previously segmented dot data.

Parameters
  • classifiers – Pre-trained classifiers predicting single and double dot quality and dotregime.

  • run_ids – QCoDeS data run IDs.

  • db_name – Name of database where datasets are saved.

  • db_folder – Path to folder containing segment_db_name.

Returns

dict – Mapping run IDs onto a dict holding the respective classification result of all classifiers passed. For example: clf_result = {<run_id>: {‘singledot’: True, ‘doubledot’: False, ‘dotregime’: False}}.

nanotune.tuningstages.chargediagram_tasks.get_dot_segment_regimes(dot_segments_classification_result: Dict[int, Dict[str, int]], determine_regime: Callable[[Dict[str, Union[bool, int]]], int]) Dict[int, int][source]

Takes the classification results of several datasets, merging the predictions of several classifiers into a single regime indicator. The decision about how predictions is unified is implented in resolve_regime.

Parameters
  • dot_segments_classification_result – Classification predictions of datasets. Each run_id maps onto a dictionary holding multiple prediction outcomes.

  • determine_regime – Function merging several classification outcomes into a single regime indicator.

Returns

dict – Mapping run_ids on a single regime indicator.

nanotune.tuningstages.chargediagram_tasks.determine_dot_regime(classification_result: Dict[str, Union[bool, int]]) int[source]

Determines the dot regime based on the classification outcome of single and double dot quality and dot regime predictions.

Parameters

classification_result – Single and double dot quality, and dotregime predictions of a single dataset. Required items are ‘singledot’, ‘doubledot’ and ‘dotregime’ keys mapping onto their respective classifiers.

Returns

int – Regime indicator, according to the regime mapping defined in nt.config[“core”][“dot_mapping”].

nanotune.tuningstages.chargediagram_tasks.translate_dot_regime(regime: int) Tuple[str, bool][source]

Takes an integer regime indicator and returns the corresponding charge state and quality as a string and boolean respectively. Uses the dot regime mapping defined in nt.config[“core”][“dot_mapping”].

Parameters

regime – Dot regime indicator.

Returns
  • str – Charge state, e.g. ‘singledot’.

  • bool – quality.

nanotune.tuningstages.chargediagram_tasks.verify_dot_classification(target_regime: str, regimes: Sequence[int]) bool[source]

Verifies if the target regime has been found.

Parameters
  • target_regime – E.g. ‘doubledot’.

  • regimes – List of regimes (int indicators) found within a diagram.

Returns

bool – Whether or not the target regime has been found.

nanotune.tuningstages.chargediagram_tasks.conclude_dot_classification(target_charge_state: str, dot_segments: Dict[int, Any], verify_classification_outcome: Callable[[str, Sequence[int]], bool], interpret_single_outcome: Callable[[int], Tuple[str, bool]]) Tuple[str, bool][source]

Determines the charge state and quality of a charge diagram based on classification outcomes of its segments/sub-measurements.

Parameters
  • target_charge_state – Target charge state

  • dot_segments – Dictionary mapping run_ids of dot segments onto their predicted regime.

  • verify_classification_outcome – Function checking whether the target regime has been found.

  • interpret_single_outcome – Interprets the classification result (int) to return a string and bool indicating the charge state and quality.

Returns
  • str – Charge state, e.g. singledot.

  • bool – quality.

nanotune.tuningstages.chargediagram_tasks.get_range_directives_chargediagram(fit_range_update_directives: List[str], current_valid_ranges: Sequence[Sequence[float]], safety_voltage_ranges: Sequence[Sequence[float]]) Tuple[List[str], List[str]][source]

Determines voltage range directives to update ranges for a subsequent tuning stage iteration. It checks if the voltage range update directives determined previously, e.g by a fit class, can be carried out based on the supplied safety ranges.

Parameters
  • fit_range_update_directives – Directives determined previously, such as during fitting.

  • current_valid_ranges – Voltage range swept at previous iteration.

  • safety_voltage_ranges – Safety range of gate/voltage parameter swept.

Returns
  • list – Range update directives, e.g. ‘x more negative’.

  • list – Issues encountered, e.g. ‘positive safety voltage reached’.

nanotune.tuningstages.chargediagram_tasks.get_new_chargediagram_ranges(current_valid_ranges: Sequence[Sequence[float]], safety_voltage_ranges: Sequence[Sequence[float]], range_update_directives: List[str], range_change_settings: Optional[Dict[str, float]] = None) Sequence[Sequence[float]][source]

Determines new voltage ranges for a subsequent tuning stage iteration. Ranges are shifted based on range_update_directives and range_change_settings, and using get_new_range.

Parameters
  • current_valid_ranges – Current voltage ranges.

  • safety_voltage_ranges – List of safety ranges.

  • range_update_directives – List of range update directives.

Returns

Tuple – New voltage range.

nanotune.tuningstages.chargediagram_tasks.get_new_range(current_valid_range: Sequence[float], safety_voltage_range: Sequence[float], direction: str, relative_range_change: float = 0.3, min_change: float = 0.05, max_change: float = 0.5) Sequence[float][source]

Determines a new voltage range, to be measured in a subsequent tuning stage iteration. The range is shifted to more positive or negative values depending on direction.

Parameters
  • current_valid_range – Current voltage ranges.

  • safety_voltage_range – List of safety ranges.

  • direction – Range update directive, either ‘positive’ or ‘negative’.

  • relative_range_change – Relative voltage shift, in percent of current valid ranges.

  • min_change – Minimum range change in Volt. New ranges will be shifted by at least this voltage difference.

  • max_change – Maximum range change in Volt. New ranges will be shifted by at most this voltage difference.

Returns

tuple – New voltage range.