nanotune.device_tuner.tuningresult

class nanotune.device_tuner.tuningresult.TuningResult(stage: str, success: bool, guids: ~typing.List[str] = <factory>, ml_result: ~typing.Dict[str, ~typing.Any] = <factory>, data_ids: ~typing.List[str] = <factory>, db_name: str = '', db_folder: str = '', termination_reasons: ~typing.List[str] = <factory>, comment: str = '', timestamp: str = '', status: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Container to hold tuning result data

Parameters
  • stage (str) – the tuning stage, e.g. ‘chargediagram’. Can be any string, not necessarily a nt.tuningstage.

  • success (bool) – whether the stage terminated successfully

  • guids (list) – List of GUIDs of the measurements taken during the stage

  • termination_reasons (list) – List of reasons why the stage did not succeed. Example: ‘no current’.

  • data_ids (list) – List of qc.run_id of the the measurements taken during the stage. Optional, for convenience.

  • db_name (str) – The database where to find data_ids, optional.

  • db_folder (str) – The database folder where to find db_name and thus data_ids. Optional

  • comment (str) – Optional string if there is anything to say about the tuning.

  • timestamp (str) – time stamp when the stage finished.

stage: str
success: bool
guids: List[str]
ml_result: Dict[str, Any]
data_ids: List[str]
db_name: str = ''
db_folder: str = ''
termination_reasons: List[str]
comment: str = ''
timestamp: str = ''
status: Dict[str, Any]
to_dict() Dict[str, Any][source]
Returns

dict – TuningResult instance as dict

to_json() str[source]
Returns

str – serialized version TuningResult instance

class nanotune.device_tuner.tuningresult.MeasurementHistory(device_name: str)[source]

Bases: object

Container to save tuning results. Each device should have its own instance. Results are saved in a dictionary mapping string indentifiers to TuningResult instances.

Parameters
  • device_name (str) – Name of device tuned.

  • tuningresults (dict) – Dictionary mapping string identifiers to instances of TuningResults.

property tuningresults

tuningresults property getter

to_dict() Dict[str, Any][source]

Merges all MeasurementHistory attributed into a dict

Returns

dict – all MeasurementHistory data in a dict

to_json() str[source]

Serializes MeasurementHistory instance to a JSON formatted sting.

Returns

str – JSON formatted serial version of MeasurementHistory instance

add_result(tuningresult: TuningResult, identifier: Optional[str] = None) None[source]

Adds TuningResult instance to self.tuningresults dictionary.

Parameters
  • tuningresult (TuningResult) –

  • identifier (Optional[str]) – default if not supplied is tuningresult.stage

update(other_measurement_history: MeasurementHistory) None[source]