How to use complexToFloat method in Airtest

Best Python code snippet using Airtest

axmlprinter.py

Source:axmlprinter.py Github

copy

Full Screen

...72 if _data == 0:73 return "false"74 return "true"75 elif _type == tc.TYPE_DIMENSION:76 return "%f%s" % (self.complexToFloat(_data), tc.DIMENSION_UNITS[_data & tc.COMPLEX_UNIT_MASK])77 elif _type == tc.TYPE_FRACTION:78 return "%f%s" % (self.complexToFloat(_data), tc.FRACTION_UNITS[_data & tc.COMPLEX_UNIT_MASK])79 elif _type >= tc.TYPE_FIRST_COLOR_INT and _type <= tc.TYPE_LAST_COLOR_INT:80 return "#%08X" % _data81 elif _type >= tc.TYPE_FIRST_INT and _type <= tc.TYPE_LAST_INT:82 if _data > 0x7fffffff:83 _data = (0x7fffffff & _data) - 0x8000000084 return "%d" % _data85 elif _type == tc.TYPE_INT_DEC:86 return "%d" % _data87 # raise exception here?88 return "<0x%X, type 0x%02X>" % (_data, _type)89 def complexToFloat(self, xcomplex):90 return (float)(xcomplex & 0xFFFFFF00) * tc.RADIX_MULTS[(xcomplex>>4) & 3];91 def getPackage(self, id):92 if id >> 24 == 1:93 return "android:"...

Full Screen

Full Screen

PAPRnet.py

Source:PAPRnet.py Github

copy

Full Screen

1import tensorflow as tf2import keras.backend as K3from keras.models import Model4from keras.layers import Input, Dense, BatchNormalization, ReLU, Lambda, Concatenate, Flatten, Add5def IFFT(sig, name=None):6 N = int(sig.shape[-1])7 return Lambda(tf.ifft, name=name, output_shape=(1,N))(sig)8def FloatToComplex(sig, name=None):9 N = int(sig.shape[-1])10 return Lambda(lambda x : tf.complex(x[:, 0:1, :], x[:, 1:2, :]), name=name, output_shape=(1,N))(sig)11def ComplexToFloat(sig, name=None):12 N = int(sig.shape[-1])13 return Concatenate(name=name, axis=-2)([Lambda(tf.real, output_shape=(1, N), name=name+'_Re')(sig), Lambda(tf.imag, output_shape=(1, N), name=name+'_Im')(sig)])14def PAPRnetEncoder(N):15 enc_in = Input((2, N), name="encoder_input")16 h1 = Dense(N*2, activation='relu', name='Dense1')(enc_in)17 h1 = BatchNormalization(name='DenseBN1')(h1)18 h2 = Dense(N*2, activation='relu', name='Dense2')(h1)19 h2 = BatchNormalization(name='DenseBN2')(h2)20 h3 = Dense(N, activation='relu', name='Dense3')(h2)21 h3 = BatchNormalization(name='DenseBN3')(h3)22 enc_out = Lambda(lambda x: x, name='encoder_output')(h3)23 return Model(inputs=[enc_in], outputs=[enc_out], name="PAPRnet_Encoder")24def PAPRnetDecoder(N):25 dec_in = Input((2,N), name="decoder_input")26 h4 = Dense(N*2, activation='relu', name='Dense4')(dec_in)27 h4 = BatchNormalization(name='DenseBN4')(h4)28 h5 = Dense(N*2, activation='relu', name='Dense5')(h4)29 h5 = BatchNormalization(name='DenseBN5')(h5)30 dec_out = Dense(N, activation='linear', name='decoder_output')(h5)31 return Model(inputs=[dec_in], outputs=[dec_out], name="PAPRnet_Decoder")32def PAPRnetAutoEncoder(N, enc, dec):33 34 # auto encoder35 enc_in = enc.input36 enc_out = enc(enc_in)37 dec_out = dec(enc_out)38 # taking ifft of encoder output - used to minimize PAPR39 cmplx = FloatToComplex(enc_out, name='EncoderOut-FloatToComplex')40 ifft = IFFT(cmplx, name='%d-IFFT' % N)41 ifft = ComplexToFloat(ifft, name='%d-IFFT-ComplexToFloat' % N)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful