Example #1
0
def do_analysis(pass_, variation = '0'):
    epr_hfss.do_EPR_analysis(variations=[variation])
    RES[pass_] = OrderedDict()

    epr = pyEPR_Analysis(epr_hfss.data_filename)
    RES[pass_]['epr'] = epr
    #epr = RES[pass_]['epr']
    RES[pass_]['freq_hfss'] = epr.freqs_hfss[variation]
    RES[pass_]['Pmj_raw']   = epr.PM[variation]

    ## NORMED
    dum = epr.get_Pmj('0')
    RES[pass_]['Pmj_normed'] = dum['PJ']       # DataFrame
    RES[pass_]['_Pmj_norm']  = dum['Pm_norm']  # Series

    RES[pass_]['mats']       = epr.get_matrices(variation, print_=False) # arrays
                             # PJ, SJ, Om, EJ, PHI_zpf
    RES[pass_]['Hres'] =Hres = zkm_get_Hparams(*RES[pass_]['mats'])
    RES[pass_]['alpha']      = Hres['alpha'] # easy access
    RES[pass_]['chi']        = Hres['chi']

    ### Numerical diagonalization
    #RES[pass_]['ND']         = None
    if 1:
        print(' ND pass=%s variation=%s' % (pass_, variation))
        from pyEPR.core import pyEPR_ND
        f1_ND, CHI_ND = pyEPR_ND(epr.freqs_hfss[variation], epr.Ljs[variation],
                                 RES[pass_]['mats'][-1], # PHI_zpf
                                 cos_trunc=10, fock_trunc=9)
        RES[pass_]['ND']        = {}
        RES[pass_]['ND']['f01'] = f1_ND
        RES[pass_]['ND']['CHI'] = CHI_ND

    return Hres
Example #2
0
import time
if 1:

    for pass_ in passes:
        print(' Running pass #%s' % (pass_), end='')
        setup.passes = str(pass_)
        try:
            ret = setup.solve(
            )  # I tried to use a worker thread but this gets complicated with COM blocking interface
            if ret in [0, '0']:
                print('.  Normal completion.')
                time.sleep(0.5)
                do_analysis(pass_)
                do_plot(RES)
            elif ret in ['-1', -1]:
                print('.  Simulation error.')
            print(ret)
        except KeyboardInterrupt:
            print('\n\n Keyboard interruption...')
            break
        # ABORT: -2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024349), None)
    do_plot(RES)

#%%
if 0:
    epr_hfss.do_EPR_analysis()

    # 4.  Hamiltonian analysis
    epr = pyEPR_Analysis(epr_hfss.data_filename)
    epr.analyze_all_variations(cos_trunc=8, fock_trunc=7)
    epr.plot_Hresults()