<commit_before>
from scanmode import ScanMode
from . import subscan
from .. import frame
from ..errors import ScanError

class NoddingScan(ScanMode):
    def __init__(self, feeds, duration, sequence):
        ScanMode.__init__(self)
        self.feed_a = feeds[0]
        self.feed_b = feeds[1]
        self.duration = duration
        self.sequence = sequence
        self.unit_subscans = sum(el[0] for el in self.sequence)
        self.frame = frame.NULL

    def _do_scan(self, _target, _receiver, _frequency):
        #import ipdb;ipdb.set_trace()
        if not _target.offset_coord.is_null():
            if not _target.offset_coord.frame == frame.HOR:
                raise ScanError("cannot perform nodding on target with offsets")
        offset_a = _receiver.feed_offsets[self.feed_a]
        offset_b = _receiver.feed_offsets[self.feed_b]
        _subscans = []
        for element in self.sequence:
            for repetitions in range(element[0]):
                if element[1] == "a":
                    offset = offset_a
                else:
                    offset = offset_b
                ss = subscan.get_sidereal(_target,
                                          offset,
                                          self.duration,
                                          element[2])
                st = subscan.get_tsys(_target,
                                      offset)
                _subscans.append((ss, st))
        return _subscans
<commit_msg>fixed cal activation in nodding scanmode<commit_after>
from scanmode import ScanMode
from . import subscan
from .. import frame
from ..errors import ScanError

class NoddingScan(ScanMode):
    def __init__(self, feeds, duration, sequence):
        ScanMode.__init__(self)
        self.feed_a = feeds[0]
        self.feed_b = feeds[1]
        self.duration = duration
        self.sequence = sequence
        self.unit_subscans = sum(el[0] for el in self.sequence)
        self.frame = frame.NULL

    def _do_scan(self, _target, _receiver, _frequency):
        #import ipdb;ipdb.set_trace()
        if not _target.offset_coord.is_null():
            if not _target.offset_coord.frame == frame.HOR:
                raise ScanError("cannot perform nodding on target with offsets")
        if not _receiver.is_multifeed():
            raise ScanError("cannot execute nodding scan with single feed receiver")
        offset_a = _receiver.feed_offsets[self.feed_a]
        offset_b = _receiver.feed_offsets[self.feed_b]
        _subscans = []
        for element in self.sequence:
            for repetitions in range(element[0]):
                if element[1] == "a":
                    offset = offset_a
                else:
                    offset = offset_b
                ss = subscan.get_sidereal(_target,
                                          offset,
                                          self.duration,
                                          is_cal=element[2])
                st = subscan.get_tsys(_target,
                                      offset)
                _subscans.append((ss, st))
        return _subscans

{'fraction_non_alphanumeric': 0.07906530089628681, 'fraction_numerical': 0.0038412291933418692, 'mean_word_length': 1.5762572135201978, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704265', 'n_tokens_mistral': 858, 'n_tokens_neox': 807, 'n_words': 205}