Exemple #1
0
def check_mode_change(scans, scan_offset, stations, scan_mode):
    """
    scan_mode: {index in scans: mode name}
    Returns whether any scan failed the mode change gap check.
    """
    stations = [s for s in stations if is_field_system_station(s)]
    any_warning = False
    scan_pairs = zip(scans[:-1], scans[1:])
    for scan_index, (scan, next_scan) in enumerate(scan_pairs, scan_offset):
        if any(station.stascn[scan_index] and station.stascn[scan_index + 1]
               for station in stations) \
            and (scan_mode[scan_index - scan_offset] !=
                 scan_mode[scan_index - scan_offset + 1]) \
            and ((next_scan.startj - scan.stopj) * secpday
                 < minimum_mode_change_gap_seconds):
            stations_string = ", ".join(
                station.station for station in stations
                if station.stascn[scan_index] and station.stascn[scan_index +
                                                                 1])
            # print warning for next scan, +1 for next, +1 for FORTRAN indexing
            s.prtscn(scan_index + 2, "VXSCHK")
            s.wlog(
                1, "WARNING: Mode setup <= {l}s for station(s) {s}.\n"
                "         FS Stations once needed {l}s for any mode "
                "change, incl frequency shift.".format(
                    s=stations_string, l=minimum_mode_change_gap_seconds))
            s.wlog(
                1, "         This may no longer be true but the new value "
                "is not yet clear.")
            any_warning = True
    return any_warning
Exemple #2
0
def check_recording_sizes(scans, scan_offset, stations):
    """
    Print warnings for large continuous recordings.
    """
    # gather the scan indices that trigger the warnings
    scan_warnings = set()
    for station in (
            s for s in stations
            if is_field_system_station(s) and s.disk != "LBADR" and s.usedisk):
        previous_scan_index = None
        previous_gbytes = 0
        for scan_index, scan in ((i, s)
                                 for i, s in enumerate(scans, scan_offset)
                                 if station.stascn[i]):
            if previous_scan_index is not None:
                previous_scan = scans[previous_scan_index - scan_offset]
                if (scan.startj - previous_scan.stopj) * secpday > gap_seconds:
                    previous_gbytes = station.gbytes[previous_scan_index]

            gbytes = station.gbytes[scan_index]
            if gbytes - previous_gbytes > max_disk_unit:
                scan_warnings.add(scan_index)

            previous_scan_index = scan_index

    # print messages, do not print a new message for consecutive scans
    previous_scan_index = -42  # any value that triggers the check below
    for scan_index in sorted(scan_warnings):
        if scan_index != previous_scan_index + 1:
            s.wlog(
                0, "The scan detailed below has exceeded the limit for "
                "continuous recording. Insert a gap before this scan, or "
                "reduce its length if necessary:")
            s.prtscn(scan_index + 1, "VXSCH")
            s.wlog(0, " ")

        previous_scan_index = scan_index

    if len(scan_warnings) > 0:
        s.wrtmsg(1, "VXSCH", "warnbank")
Exemple #3
0
def apply_tape_offset(scans, scan_offset, stations, setups):
    for scan_index, scan in enumerate(scans, scan_offset):
        stations_in_scan = [
            station for station in stations if station.stascn[scan_index]
        ]
        tape_starts = {
            station.tpstart[scan_index]
            for station in stations_in_scan
        }
        if len(tape_starts) == 0:
            continue
        if len(tape_starts) > 1:
            # -1 and +1: from FORTRAN index <-> python index
            min_pause = max(station.tpstart[scan_index] /
                            setup[station.nsetup[scan_index] - 1].speedup
                            for station in stations_in_scan)
            s.prtscn(scan_index + 1, "VXSCHK")
            s.errlog("Station tape starts differ, set MINPAUSE to {}s to "
                     "produce VEX file!".format(round(min_pause * secpday)))

        tape_start = tape_starts.pop()
        scan.startj -= tape_start
Exemple #4
0
def check_minimum_scan_duration(scans, scan_offset, stations):
    """
    Returns whether any scan failed the minimum duration check.
    """
    # only check certain stations, mimic SCHED here
    stations = [
        s for s in stations
        if is_field_system_station(s) and s.disk != "LBADR" and s.usedisk
    ]
    any_warning = False
    for scan_index, scan in enumerate(scans, scan_offset):
        if any(station.stascn[scan_index] for station in stations) \
           and ((scan.stopj - scan.startj) * secpday < minimum_scan_seconds):
            stations_string = ", ".join(station.station for station in stations
                                        if station.stascn[scan_index])
            s.prtscn(scan_index + 1, "VXSCHK")
            s.wlog(
                1, "WARNING: Scan length < {l}s for station(s) {s}.\n"
                "         Currently FS supports minimal "
                "scan length of {l}s".format(s=stations_string,
                                             l=minimum_scan_seconds))
            any_warning = True
    return any_warning
Exemple #5
0
def check_scan_overlap(scans, scan_offset, stations):
    """
    Returns whether any scan failed the scan overlap check.
    """
    any_warning = False
    scan_pairs = zip(scans[:-1], scans[1:])
    for scan_index, (scan, next_scan) in enumerate(scan_pairs, scan_offset):
        if any(station.stascn[scan_index] and station.stascn[scan_index + 1]
               for station in stations) \
            and (next_scan.startj < scan.stopj):
            stations_string = ", ".join(
                station.station for station in stations
                if station.stascn[scan_index] and station.stascn[scan_index +
                                                                 1])
            # print warning for next scan, +1 for next, +1 for FORTRAN indexing
            s.prtscn(scan_index + 2, "VXSCHK")
            s.wlog(1, "WARNING: Tape early start failed for stations(s) {}.".\
                   format(s=stations_string))
            s.wlog(
                1, "         Early tape starts only work if there are "
                "sufficient gaps.")
            any_warning = True
    return any_warning