nanotune.data.databases
- nanotune.data.databases.get_dataIDs(db_name: str, category: str, db_folder: Optional[str] = None, quality: Optional[int] = None, get_run_ids: bool = True) List[int] [source]
Returns QCoDeS run IDs of datasets belonging to a specific category of measurements, assigned to the data during labelling.
The entire database db_name is searched and a column of the same name as the category looked up needs to exist in it. Example of categories are pinchoff, singledot or doubledot, all valid ones are defined in configuration.config.json under the “labels” key. Optionally, the quality can be specified. Quality and category together are the machine learning labels nanotune uses during classification.
- Parameters
db_name – name of database to search.
category – measurement type/category we are looking for. E.g. pinchoff, singledot or doubledot.
db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.
quality – Optional if a specific quality is required. 1==good, 0==poor.
get_run_ids – whether to return run IDs. Returns captured run IDs if False.
- Returns
List of QCoDeS run IDs.
- nanotune.data.databases.get_unlabelled_ids(db_name: str, db_folder: Optional[str] = None, get_run_id: bool = True) List[int] [source]
Gets run IDs all unlabelled datasets in a database. A dataset is selected if it doesn’t have a value in the good column.
- Parameters
db_name – name of database to search.
db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.
get_run_id – whether to return run IDs. Returns captured run IDs if False.
- Returns
List of QCoDeS run IDs which do not have a machine learning label.
- nanotune.data.databases.list_experiments(db_folder: Optional[str] = None) Tuple[str, Dict[str, List[int]]] [source]
Lists all databases and their experiments within a folder.
- Parameters
db_folder – the folder to enumerate.
- Returns
str – name of folder which was searched.
dict – mapping database name to a list of experiment IDs.
- nanotune.data.databases.new_database(db_name: str, db_folder: Optional[str] = None) str [source]
Create new database and initialise it with nanotune labels. A separate column for each label is created.
- Parameters
db_name – name of new database.
db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.
- Returns
str – absolute path of new database.
- nanotune.data.databases.set_database(db_name: str, db_folder: Optional[str] = None) None [source]
Sets a new database to be the default one to load from and save to. If the database does not exist, a new one is created. The change is propagated to QCoDeS’ configuration.
- Parameters
db_name – name of database to set.
db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.
- nanotune.data.databases.get_database() Tuple[str, str] [source]
Gets name and folder of the current default database used by QCoDeS.
- Returns
str – database name
str – folder containing database
- nanotune.data.databases.get_last_dataid(db_name: str, db_folder: Optional[str] = None) int [source]
Returns QCoDeS run ID of last dataset in a database, i.e the highest run ID there is.
- Parameters
db_name – name of database.
db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.
- Returns
int – sum of last_counter of all experiments within a database.
- nanotune.data.databases.switch_database(temp_db_name: str, temp_db_folder: str)[source]
Context manager temporarily setting a different database. Sets back to previous database name and folder.
- Parameters
temp_db_name – name of database to set.
temp_db_folder – folder containing database. If not specified, nt.config[“db_folder”] is used.