Creating_Checkstandard_Report_Example

# Creating a Checkstandard Report¶

A check standard report is a summary of one of the devices used in the NIST check standard program. Reports can be either a comparison of a one or two port measurement file that has multiple connect measurements, with the metadata Connector_Type_Measurement and with the historical database or just a summary of a device with respect to time. The metadata normally attached with the device measurement is

    keys=["System_Id","System_Letter","Connector_Type_Calibration","Connector_Type_Measurement",
                  "Measurement_Type","Measurement_Date","Measurement_Time","Program_Used","Program_Revision","Operator",
                  "Calibration_Name","Calibration_Date","Port_Used","Number_Connects","Number_Repeats","Nbs",
                  "Number_Frequencies","Start_Frequency",
                  "Device_Description","Device_Id"]

## Links to example reports¶

### Report_1 (CTN202)

### Report_2 (C07208)

## Importing the reports module¶

In [1]:

    from pyMez.Code.Analysis.Reports import *

    Importing pyMez, this should take roughly 30 seconds
    Importing Code.DataHandlers.GeneralModels
    It took 0.480027 s to import Code.DataHandlers.GeneralModels
    Importing Code.DataHandlers.HTMLModels
    It took 0.133008 s to import Code.DataHandlers.HTMLModels
    Importing Code.DataHandlers.NISTModels
    The module smithplot was not found,please put it on the python path
    It took 0.923053 s to import Code.DataHandlers.NISTModels
    Importing Code.DataHandlers.TouchstoneModels
    It took 0.001 s to import Code.DataHandlers.TouchstoneModels
    Importing Code.DataHandlers.XMLModels
    It took 0.135007 s to import Code.DataHandlers.XMLModels
    Importing Code.DataHandlers.ZipModels
    It took 0.012001 s to import Code.DataHandlers.ZipModels
    Importing Code.InstrumentControl.Experiments
    It took 3.476199 s to import Code.InstrumentControl.Experiments
    Importing Code.InstrumentControl.Instruments
    It took 0.001 s to import Code.InstrumentControl.Instruments
    Importing Code.Utils.Names
    It took 0.0 s to import Code.Utils.Names
    It took 5.162295 s to import all of the active modules

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\odo\backends\pandas.py:102: FutureWarning: pandas.tslib is deprecated and will be removed in a future version.
    You can access NaTType as type(pandas.NaT)
      @convert.register((pd.Timestamp, pd.Timedelta), (pd.tslib.NaTType, type(None)))

## History of a device¶

In [2]:

    report_1=CheckStandardReport(Device_Id="CTN202")

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (10,11,12,16,18,19,20,27) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (14) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (8,9,14,16,17,25) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\pyMez\Code\Analysis\SParameter.py:1162: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
      values=np.mean(temp_frame[temp_frame["Frequency"]==unique_frequency_list[index]][column].as_matrix())

    measurement_type is 2

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\tight_layout.py:209: UserWarning: tight_layout cannot make axes height small enough to accommodate all axes decorations
      warnings.warn('tight_layout cannot make axes height small enough '

    Body tag was not present adding it
    Head tag was not present adding it
    index is 0

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\pyMez\Code\DataHandlers\Translations.py:572: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
      conversion_options["data"]=pandas_data_frame.as_matrix().tolist()[:]

    index is 1
    index is 2

In [3]:

    # This displays the report in a browser
    report_1.show()

    file://C:/Users/sandersa/AppData/Local/Temp/1/tmpg1zg4jh0.html

In [4]:

    # This is the default path
    report_1.path

Out[4]:

    'HTML_Document_20181103_001.html'

In [5]:

    # This saves the report as an html file under a different name
    report_1.path=os.path.join(os.getcwd(),"CheckStandard_Files/CheckStandard_Report_CTN202.html")
    report_1.save()

Out[5]:

    'C:\\Users\\sandersa\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\pyMez\\Documentation\\Examples\\jupyter\\CheckStandard_Files/CheckStandard_Report_CTN202.html'

## Comparison of a measurement with the data base¶

By just passing a file path of a measurement with the proper metadata it automatically compares the file with the database values and creates the html report.

In [6]:

    measurement_path=os.path.join(os.getcwd(),"CheckStandard_Files/C07208.L6_041304")
    report_2=CheckStandardReport(file_path=measurement_path)

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (10,11,12,16,18,19,20,27) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (14) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2901: DtypeWarning: Columns (8,9,14,16,17,25) have mixed types. Specify dtype option on import or set low_memory=False.
      if self.run_code(code, result):

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\pyMez\Code\Analysis\SParameter.py:1162: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
      values=np.mean(temp_frame[temp_frame["Frequency"]==unique_frequency_list[index]][column].as_matrix())
    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\pyMez\Code\Analysis\SParameter.py:1222: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
      mean_row=mean_frame[abs(mean_frame["Frequency"]-row[0])<abs(.01)].as_matrix()

    Body tag was not present adding it
    Head tag was not present adding it
    index is 0
    index is 1
    index is 2

    C:\Users\sandersa\AppData\Local\Continuum\anaconda3\lib\site-packages\pyMez\Code\DataHandlers\Translations.py:572: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
      conversion_options["data"]=pandas_data_frame.as_matrix().tolist()[:]

    index is 3
    index is 4

In [7]:

    # This displays the report in a browser
    report_2.show()

    file://C:/Users/sandersa/AppData/Local/Temp/1/tmpvu9437gn.html

In [8]:

    # This saves the file
    report_2.path=os.path.join(os.getcwd(),"CheckStandard_Files/CheckStandard_Report_C07208.html")
    report_2.save()

Out[8]:

    'C:\\Users\\sandersa\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\pyMez\\Documentation\\Examples\\jupyter\\CheckStandard_Files/CheckStandard_Report_C07208.html'

## The database is not distributed with the pyMez package, it is too big.¶

The constants in the module pyMez.Code.Analysis.Reports define the location of the data base.

    TWO_PORT_NR_CHKSTD_CSV=r"C:\Share\Converted_Check_Standard\Two_Port_NR_Check_Standard.csv"
    COMBINED_ONE_PORT_CHKSTD_CSV=r"C:\Share\Converted_Check_Standard\Combined_One_Port_Check_Standard.csv"
    COMBINED_TWO_PORT_CHKSTD_CSV=r"C:\Share\Converted_Check_Standard\Combined_Two_Port_Check_Standard.csv"
    COMBINED_POWER_CHKSTD_CSV=r"C:\Share\Converted_Check_Standard\Combined_Power_Check_Standard.csv"
    ONE_PORT_CALREP_CSV=r"C:\Share\Converted_DUT\One_Port_DUT.csv"
    TWO_PORT_CALREP_CSV=r"C:\Share\Converted_DUT\Two_Port_DUT.csv"
    POWER_3TERM_CALREP_CSV=r"C:\Share\Converted_DUT\Power_3Term_DUT.csv"
    POWER_4TERM_CALREP_CSV=r"C:\Share\Converted_DUT\Power_4Term_DUT.csv"