Beispiel #1
0
def eval_loc_sym(loc,del_hf_expr,deriv_symbs_string,f,inj_params,conv_cos,conv_log):
    print(' ',loc)
    del_hf = {}
    del_hf_expr = dill.loads(del_hf_expr)
    for deriv in del_hf_expr:
        if deriv in ('variables','deriv_variables'): continue
        del_hf[deriv] = del_hf_expr[deriv](f,**bfs.get_sub_dict(inj_params,del_hf_expr['variables']))
    return dc.get_conv_del_eval_dic(del_hf,inj_params,conv_cos,conv_log, deriv_symbs_string)
Beispiel #2
0
 def calc_wf_polarizations_derivs_sym(self):
     print('Evaluate polarizations.')
     self.calc_wf_polarizations()
     self.del_hfpc = {}
     for deriv in self.del_hfpc_expr:
         if deriv in ('variables','deriv_variables'): continue
         self.del_hfpc[deriv] = self.del_hfpc_expr[deriv](self.f, **bfs.get_sub_dict(self.inj_params, self.del_hfpc_expr['variables']))
     self.del_hfpc, c_quants = dc.get_conv_del_eval_dic(self.del_hfpc, self.inj_params, self.conv_cos, self.conv_log, self.deriv_symbs_string)
     self.inj_params, self.deriv_variables = dc.get_conv_inj_params_deriv_variables(c_quants, self.inj_params, self.deriv_variables)
     print('Lambdified polarizations evaluated.')
Beispiel #3
0
 def calc_error_mats(self, only_net, df, cond_sup):
     print(' ', self.det_key)
     del_vs_f_dic = bfs.get_sub_dict(self.del_hf, ('hf', ), 0)
     if not only_net:
         self.fisher, self.cov, self.wc_fisher, self.cond_num = fat.fisher_cov_matrix(
             list(del_vs_f_dic.values()), self.psd, self.f, 0, df, cond_sup)
         return self.fisher
     else:
         fisher, _, _, _ = fat.fisher_cov_matrix(
             list(del_vs_f_dic.values()), self.psd, self.f, 1, df, cond_sup)
         return fisher
Beispiel #4
0
    def calc_det_responses_derivs_sym(self, wf, inj_params, deriv_variables,
                                      conv_cos, conv_log, deriv_symbs_string):
        print(' ', self.det_key)
        self.calc_det_responses(wf, inj_params)
        self.del_hf = {}
        for deriv in self.del_hf_expr:
            if deriv in ('variables', 'deriv_variables'): continue
            self.del_hf[deriv] = self.del_hf_expr[deriv](
                self.f, **bfs.get_sub_dict(inj_params,
                                           self.del_hf_expr['variables']))

        self.del_hf, c_quants = get_conv_del_eval_dic(self.del_hf, inj_params,
                                                      conv_cos, conv_log,
                                                      deriv_symbs_string)
        inj_params, deriv_variables = get_conv_inj_params_deriv_variables(
            c_quants, inj_params, deriv_variables)
def calc_det_responses_num(loc,
                           wf,
                           deriv_symbs_string,
                           f_arr,
                           params_dic,
                           use_rot=1,
                           label='hf',
                           step=1e-7,
                           method='central',
                           order=2,
                           n=1):

    wf_symbs_list = wf.wf_symbs_string.split(' ')
    deriv_symbs_list = deriv_symbs_string.split(' ')

    if 'f' in wf_symbs_list:
        wf_symbs_list.remove('f')
    if 'f' in deriv_symbs_list:
        deriv_symbs_list.remove('f')

    if loc == None:
        wf_params_list = list(
            bfs.get_sub_dict(params_dic, wf_symbs_list).values())

        def pc_func(f_arr, *wf_params_list):
            wf_list = []
            for i, el in enumerate(wf_symbs_list):
                wf_list.append(wf_params_list[wf_symbs_list.index(el)])
            return wf.eval_np_func(f_arr, wf_list)

        return wfd_num.part_deriv_hf_func(pc_func,
                                          wf_symbs_list,
                                          deriv_symbs_list,
                                          f_arr,
                                          params_dic,
                                          pl_cr=1,
                                          compl=1,
                                          label=label,
                                          step=step,
                                          method=method,
                                          order=order,
                                          n=n)

    else:
        ap_symbs_list = ant_pat_symbs_string.split(' ')
        if 'f' in ap_symbs_list:
            ap_symbs_list.remove('f')

        dr_symbs_list = bfs.reduce_symbols_strings(
            wf.wf_symbs_string, ant_pat_symbs_string).split(' ')
        dr_params_list = list(
            bfs.get_sub_dict(params_dic, dr_symbs_list).values())

        def dr_func(f_arr, *dr_params_list):
            wf_list = []
            for i, el in enumerate(wf_symbs_list):
                wf_list.append(dr_params_list[dr_symbs_list.index(el)])

            ap_list = []
            for i, el in enumerate(ap_symbs_list):
                ap_list.append(dr_params_list[dr_symbs_list.index(el)])

            hfp, hfc = wf.eval_np_func(f_arr, wf_list)
            Fp, Fc, Flp = ant_pat_np.antenna_pattern_and_loc_phase_fac(
                f_arr, *ap_list, loc, use_rot)

            return Flp * (hfp * Fp + hfc * Fc)

        return wfd_num.part_deriv_hf_func(dr_func,
                                          dr_symbs_list,
                                          deriv_symbs_list,
                                          f_arr,
                                          params_dic,
                                          pl_cr=0,
                                          compl=1,
                                          label=label,
                                          step=step,
                                          method=method,
                                          order=order,
                                          n=n)
Beispiel #6
0
 def calc_det_responses(self, wf, inj_params):
     hfp, hfc = wf.eval_np_func(
         self.f, bfs.get_sub_dict(inj_params, wf.wf_symbs_string))
     self.hf = self.Flp * (hfp * self.Fp + hfc * self.Fc)
Beispiel #7
0
 def calc_wf_polarizations(self):
     self.hfp, self.hfc = self.wf.eval_np_func(self.f,bfs.get_sub_dict(self.inj_params,self.wf.wf_symbs_string))
     print('Polarizations calculated.')