def get_q_density(*args): """ Returns the array of complex charge densities in Coulomb/meter. """ if _get_n(*args) != 0: if _get_iptflq(*args) != -1: return _PyNEC.nec_structure_currents_get_q_density(*args) else: error_msg = "The printing of charge densities has not been requested." raise exceptions.Warning(error_msg) else: error_msg = "There are no wires in the structure." raise exceptions.Warning(error_msg)
def get_current(*args): """ Returns the array of complex currents in Ampere. """ if _get_n(*args) != 0: _iptflg = _get_iptflg(*args) if _iptflg != -1: return _PyNEC.nec_structure_currents_get_current(*args) else: error_msg = "The printing of currents has not been requested." raise exceptions.Warning(error_msg) else: error_msg = "There are no wires in the structure." raise exceptions.Warning(error_msg)
def get_q_density_segment_length(*args): """ Returns the array of segment lengths in meters for the printing of charge densities. """ if _get_n(*args) != 0: if _get_iptflq(*args) != -1: return _PyNEC.nec_structure_currents_get_q_density_segment_length( *args) else: error_msg = "The printing of charge densities has not been requested." raise exceptions.Warning(error_msg) else: error_msg = "There are no wires in the structure." raise exceptions.Warning(error_msg)
def get_gain_type(*args): """ Returns the type of gain computed : power or directive gain. """ if _get_ifar(*args) != 1 : ipd = _get_rp_ipd(*args) if ipd == 0 : return "Power gain" elif ipd == 1 : return "Directive gain" else : error_msg = "Unknown gain type." raise exceptions.Warning(error_msg) else : error_msg = "No computing of gain has been requested." raise exceptions.Warning(error_msg)
def get_keys(self, cr, uid, ids, context={}): aeat_obj = self.pool['l10n.es.aeat.sii'] for wizard in self.browse(cr, uid, ids): record = self.pool['l10n.es.aeat.sii'].browse( cr, uid, context.get('active_id'), context=context) directory = os.path.join(os.path.abspath(record.path_folder), 'certificates', cr.dbname, record.folder) file = base64.decodestring(record.file) if tuple(map(int, OpenSSL.__version__.split('.'))) < (0, 15): raise exceptions.Warning( _('OpenSSL version is not supported. Upgrade to 0.15 ' 'or greater.')) try: if directory and not os.path.exists(directory): os.makedirs(directory) with pfx_to_pem(file, wizard.password, directory) as private_key: aeat_obj.write(cr, uid, record.id, {'private_key': private_key}) with pfx_to_crt(file, wizard.password, directory) as public_key: aeat_obj.write(cr, uid, record.id, {'public_key': public_key}) except Exception as e: if e.args: args = list(e.args) raise exceptions.osv_exception(args[-1]) return {'type': 'ir.actions.act_window_close'}
def execute(self, method, arg_list, kwarg_dict=None): try: res = self.api.execute_kw(self.db, self.uid, self.pwd, self.model, method, arg_list, kwarg_dict or {}) return res except: raise exceptions.Warning("Mete algun dato por lo menos")
def get_gain_minor_axis(*args): """ Returns the array of minor axis gains in dB provided the output format chosen is format 0. """ if _get_rp_output_format(*args)==0 : return _reshape(_PyNEC.nec_radiation_pattern_get_gain_horiz(*args),*args) else : error_msg="The computing of the 'minor axis' gain has not been requested. Try and get the horizontal gain instead." raise exceptions.Warning(error_msg)
def get_gain_vert(*args): """ Returns the array of vertical gains provided the output format chosen is format 1. """ if _get_rp_output_format(*args)==1 : return _reshape(_PyNEC.nec_radiation_pattern_get_gain_vert(*args),*args) else : error_msg="The computing of the vertical gain has not been requested. Try and get the 'major axis' gain instead." raise exceptions.Warning(error_msg)
def get_radial_attenuation(self): """ Returns the radial attenuation (no units) provided the calculation mode chosen is different from mode 1. """ if (_get_ifar(self) != 1) : _range = _get_range(self) if (_range >= 1.0e-20) : _wavelength = _get_wavelength(self) exrm = 1.0 / _range; exra = _range/ _wavelength; exra = -360.0*(exra - math.floor(exra)); return ("EXP(-JKR)/R : %.5e at phase %.2f degrees" % (exrm, exra)) else : error_msg = "The radial distance value is bellow 1E-20 : the attenuation is ignored." raise exceptions.Warning(error_msg) else : error_msg = "The radial attenuation is not available for this calculation mode." raise exceptions.Warning(error_msg)
def get_radial_distance(*args): """ Returns the radial distance in meters provided the calculation mode chosen is different from mode 1. """ if _get_ifar(*args) != 1 : return _get_range(*args) else : error_msg = " The radial distance is not defined for this calculation mode." raise exceptions.Warning(error_msg)
def get_normalized_gain(self): """ Returns the array of normalized gains in dB. """ if (_get_rp_normalization(*args)) != 0 : return _get_gain(self)-self.get_normalization_factor() else : error_msg = "No normalization has been requested." raise exceptions.Warning(error_msg)
def _get_rp_ipd(arg0): """ Returns the flag (no units) which indicates the type of gain computed : power or directive gain. """ if _get_ifar(arg0) != 1 : return _PyNEC.nec_radiation_pattern_get_rp_ipd(arg0) else : error_msg = "No computing of gain has been requested." raise exceptions.Warning(error_msg)
def _get_rp_average(arg0): """ Returns the flag (no units) which indicates whether the average gain will be computed or not. """ if _get_ifar(arg0) != 1 : return _PyNEC.nec_radiation_pattern_get_rp_power_average(arg0) else : error_msg = "No computing of gain has been requested." raise exceptions.Warning(error_msg)
def _get_rp_output_format(arg0): """ Returns the flag (no units) which indicates the output format chosen. """ if _get_ifar(arg0) != 1 : return _PyNEC.nec_radiation_pattern_get_rp_output_format(arg0) else : error_msg = "No computing of gain has been requested." raise exceptions.Warning(error_msg)
def _get_rp_normalization(arg0): """ Returns the flag (no units) which indicates the target of the normalization process. """ if _get_ifar(arg0) != 1 : return _PyNEC.nec_radiation_pattern_get_rp_normalization(arg0) else : error_msg = "No computing of gain has been requested." raise exceptions.Warning(error_msg)
def get_e_r(*args): """ Returns the array of complex radial-component of electric field E in Volt/meter - only available for the calculation mode 1. """ if _get_ifar(*args) == 1 : return _reshape(_PyNEC.nec_radiation_pattern_get_e_r(*args),*args) else : error_msg="The radial field is not available for this calculation mode." raise exceptions.Warning(error_msg)
def get_patch_e_y(*args): """ Returns the complex y-component of the currents (in Amps/meter). """ if _get_m(*args) != 0: return _PyNEC.nec_structure_currents_get_patch_e_y(*args) else: error_msg = "There are no patches in the structure." raise exceptions.Warning(error_msg)
def get_patch_e_z(*args): """ Returns the complex z-component of the electric field E. """ if _get_m(*args) != 0: return _PyNEC.nec_structure_currents_get_patch_e_z(*args) else: error_msg = "There are no patches in the structure." raise exceptions.Warning(error_msg)
def get_normalization_factor(*args): """ Returns the normalization factor in dB provided a normalization has been requested. """ if (_get_rp_normalization(*args)) != 0 : return _PyNEC.nec_radiation_pattern_get_normalization_factor(*args) else : error_msg = "No normalization has been requested." raise exceptions.Warning(error_msg)
def get_patch_center_z(*args): """ Returns the array of z-coordinate of patch centers. """ if _get_m(*args) != 0: return _PyNEC.nec_structure_currents_get_patch_center_z(*args) else: error_msg = "There are no patches in the structure." raise exceptions.Warning(error_msg)
def get_current_phi(*args): """ Returns the array of phi angles in degrees for the printing of currents, provided the format designed for a receiving pattern has been requested. """ if _get_n(*args) != 0: _iptflg = _get_iptflg(*args) if _iptflg != -1: if _iptflg == 1 or _iptflg == 2: return _PyNEC.nec_structure_currents_get_current_phi(*args) else: error_msg = "Wrong ouptut format." raise exceptions.Warning(error_msg) else: error_msg = "The printing of currents has not been requested." raise exceptions.Warning(error_msg) else: error_msg = "There are no wires in the structure." raise exceptions.Warning(error_msg)
def get_e_x(*args): """ Returns the array of x_components of the electric field. """ if(_get_nfeh(*args) != 1): return _PyNEC.nec_near_field_pattern_get_field_x(*args) else: error_msg = "This result is a Near Magnetic Field Pattern. Try and get 'h_x' instead." raise exceptions.Warning(error_msg)
def get_patch_tangent_vector2(*args): """ Returns the array of complex tangent vector 2 of the patches. """ if _get_m(*args) != 0: return _PyNEC.nec_structure_currents_get_patch_tangent_vector2( *args) else: error_msg = "There are no patches in the structure." raise exceptions.Warning(error_msg)
def get_current_segment_length(*args): """ Returns the array of segment lengths in meters for the printing of currents, provided the standard output format has been requested. """ if _get_n(*args) != 0: _iptflg = _get_iptflg(*args) if _iptflg != -1: if _iptflg == -2 or _iptflg == 0: return _PyNEC.nec_structure_currents_get_current_segment_length( *args) else: error_msg = "Wrong ouptut format." raise exceptions.Warning(error_msg) else: error_msg = "The printing of currents has not been requested." raise exceptions.Warning(error_msg) else: error_msg = "There are no wires in the structure." raise exceptions.Warning(error_msg)
def get_average_gain(*args): """ Returns the array of average power gains in dB, provided its computation has been requested. """ _rpa=_get_rp_power_average(*args) if _rpa==1 or _rpa==2 : return _PyNEC.nec_radiation_pattern_get_average_gain(*args) else : error_msg="The computing of the average gain has not been requested." raise exceptions.Warning(error_msg)
def get_average_solid_angle(*args): """ Returns the solid angle in steradians used in the averaging process, provided the computation of an average gain has been requested. """ _rpa=_get_rp_power_average(*args) if _rpa==1 or _rpa==2 : return _PyNEC.nec_radiation_pattern_get_average_solid_angle(*args) else : error_msg="The computing of the average gain has not been requested." raise exceptions.Warning(error_msg)
def get_gain_type(*args): """ Returns the type of gain computed : power or directive gain. """ ipd = _get_rp_ipd(*args) if ipd == 0 : return "Power gain" elif ipd == 1 : return "Directive gain" else : error_msg = "Unknown gain type : " + ipd.__str__() + "." raise exceptions.Warning(error_msg)
def get_averaging_mode(*args): """ Returns the averaging mode. """ _rpa=_get_rp_average(*args) if _rpa == 0 : return "No averaging requested" elif _rpa == 1 : return "Averaging of the total gain requested" else : error_msg = "Unknown averaging mode : " + _rpa.__str__() + "." raise exceptions.Warning(error_msg)
def get_output_format(*args): """ Returns the type of output format. """ _output_format = _get_rp_output_format(*args) if _output_format == 0 : return 'major axis, minor axis and total gain computed' elif _output_format == 1 : return 'vertical, horizontal ant total gain printed' else : error_msg = "Unknown output format." raise exceptions.Warning(error_msg)
def get_current_output_format(*args): """ Returns the output format used for the printing of currents, provided it has been requested. """ _iptflg = _get_iptflg(*args) if _iptflg != -1: if _iptflg == -2 or _iptflg == 0: return 'Standard output format' elif _iptflg == 1 or _iptflg == 2: return 'Format designed for a receiving pattern' else: error_msg = "Unknown output format." raise exceptions.Warning(error_msg)