I am trying to create a simple function in python 3.7 that returns whether or not a specific amplifier is under export compliance or not. The criteria depend on saturated power, frequency range, and fractional bandwidth.
As you can see from the example below, the compliance threshold is decreasing with increasing frequency, which makes it simple just to look for the frequency endpoint. Except for the condition at 31.8-37GHz.
Can anyone suggest a change to my code such that any frequency range that overlaps the criteria, will get flagged?
def amplifier():
freq_start = float(input('Start frequency in GHz: '))
freq_stop = float(input('Stop frequency in Ghz: '))
psat = float(input('Saturated power in dBm: '))
fractional_bw = (freq_stop-freq_start)/((freq_start+freq_stop)/2)
if 16 < freq_stop <= 31.8 and fractional_bw > 0.10 and psat > 34.77:
return 'Export compliance according to 3A001.b.2.c'
if 31.8 < freq_stop <= 37 and psat > -70:
return 'Export compliance according to 3A001.b.2.d'
if 37 < freq_stop <= 43.5 and fractional_bw > 0.10 and psat > 30:
return 'Export compliance according to 3A001.b.2.e'
if 43.5 < freq_stop <= 75 and fractional_bw > 0.10 and psat > 15:
return 'Export compliance according to 3A001.b.2.f'
if 75 < freq_stop <= 90 and fractional_bw > 0.05 and psat > 10:
return 'Export compliance according to 3A001.b.2.g'
if 90 < freq_stop and psat > -70:
return 'Export compliance according to 3A001.b.2.h'
else:
return 'Not export compliance according to 3A001.b.2'
Aucun commentaire:
Enregistrer un commentaire