Skip to content

Commit

Permalink
Define tilt target over the full amplifier bandwidth
Browse files Browse the repository at this point in the history
Currently the tilt_target defined by a user is applied over the band of
propagating channels. This means for example that if only two channels
are propagated, the difference in gain between the two channels will be
equal to the tilt_target, independently of how close the two channels
are in frequency. I think it makes more sense to always define the
tilt_target over the full operational bandwidth of the amplifier.

Signed-off-by: Jonas Mårtensson <jonas.martensson@ri.se>
Change-Id: I4f29de2edc4d0de239b34e0d8d678d964b6a0af3
  • Loading branch information
Jonas Mårtensson committed Apr 21, 2021
1 parent 3a72ce8 commit a211e30
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions gnpy/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,24 +805,21 @@ def _gain_profile(self, pin, err_tolerance=1.0e-11, simple_opt=True):
if len(self.interpol_dgt) == 1:
return array([self.effective_gain])

nb_channel = arange(len(self.interpol_dgt))

# TODO|jla: find a way to use these or lose them. Primarily we should have
# a way to determine if exceeding the gain or output power of the amp
tot_in_power_db = self.pin_db # Pin in W

# linear fit to get the
p = polyfit(nb_channel, self.interpol_dgt, 1)
p = polyfit(self.channel_freq, self.interpol_dgt, 1)
dgt_slope = p[0]

# Calculate the target slope - currently assumes equal spaced channels
# TODO|jla: support arbitrary channel spacing
targ_slope = self.tilt_target / (len(nb_channel) - 1)
# Calculate the target slope
targ_slope = self.tilt_target / (self.params.f_max - self.params.f_min)

# first estimate of DGT scaling
if abs(dgt_slope) > 0.001: # check for zero value due to flat dgt
try:
dgts1 = targ_slope / dgt_slope
else:
except ZeroDivisionError:
dgts1 = 0

# when simple_opt is true, make 2 attempts to compute gain and
Expand Down

0 comments on commit a211e30

Please sign in to comment.