Metaclass

This part of the framework contains the backbone of the computation and plot part. There have been implemented metaclass of referement for the plot and computation class implementation tailored for your own case.

Important

Both classes take as input, when instantiated, data coming from a private_config.json, if the config file is missing then you can feed this information manually

class CAF.MetaClass.ComputationClass[source]

This metaclass contains the backbone of the computation class . It is composed by 3 different elements:

  1. init : the constructor function through we collect credential to log on database and IBMQ system

  2. run : function designated to gather parameters for each run, then run calculation (on local or remote) and then save the results in the ‘final_json’ class attribute – To implement your class –

  3. save : function designated to save results on database

NB: Instantiating the class will not require any argoument because an automatic feeding has been implemented using a decorator.

abstract run()[source]

Run function

This function must be implemented in the class you are going to implement

save(db_name: str)[source]

Save function

This function save the obtained results presente on the internal json named “final_json” that is populated during the perford calculation

Parameters

db_name (str) – name of the db created on the cloud instance to collect data

class CAF.MetaClass.PlotClass[source]

This metaclass is designed to collect all the routines to query and show results. In this metaclass are provided the basic functions to instantiate the connection with database and query on it. The contructor function will retrieve the db credential and the db name. THe db_name has to be manually feeded by the user, in order to connect with the correct data source.

query(selector_dict: dict, field_list: list)[source]

Query

This function is designet to automatically query on db data just providing a selector and a field list.

Parameters
  • selector_dict (dict) – dictionary containing db query following the cloudant standard

  • field_list (list) – list of field to retrieve for the queried elements