How to use hightime - 10 common examples

To help you get started, we’ve selected a few hightime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
def test_repeated_capability_method_on_specific_channel(self):
        test_maximum_time_ms = 10     # milliseconds
        test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms)
        test_reading = 5
        self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel
        self.side_effects_helper['ReadFromChannel']['reading'] = test_reading
        with nifake.Session('dev1') as session:
            value = session.channels['3'].read_from_channel(test_maximum_time)
        self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher())
        assert value == test_reading
github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
def test_repeated_capability_method_on_session_timedelta(self):
        test_maximum_time_ms = 10     # milliseconds
        test_maximum_time_timedelta = hightime.timedelta(milliseconds=test_maximum_time_ms)
        test_reading = 5
        self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel
        self.side_effects_helper['ReadFromChannel']['reading'] = test_reading
        with nifake.Session('dev1') as session:
            value = session.read_from_channel(test_maximum_time_timedelta)
        self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher())
        assert value == test_reading
github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
def test_single_point_read_nan(self):
        test_maximum_time_s = 10.0
        test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s)
        test_reading = float('NaN')
        self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read
        self.side_effects_helper['Read']['reading'] = test_reading
        with nifake.Session('dev1') as session:
            assert math.isnan(session.read(test_maximum_time))
github ni / nimi-python / src / nidigital / system_tests / test_system_nidigital.py View on Github external
def test_frequency_counter_measure_frequency(multi_instrument_session):
    multi_instrument_session.load_pin_map(os.path.join(test_files_base_dir, "pin_map.pinmap"))
    multi_instrument_session.pins['site0/PinA', 'site1/PinC'].selected_function = nidigital.SelectedFunction.DIGITAL
    multi_instrument_session.pins['site0/PinA', 'site1/PinC'].frequency_counter_measurement_time = hightime.timedelta(milliseconds=5)
    frequencies = multi_instrument_session.pins['site0/PinA', 'site1/PinC'].frequency_counter_measure_frequency()
    assert frequencies == [0] * 2
github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
def test_set_attribute_real64_with_converter(self):
        self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
        attribute_id = 1000007
        test_number = 1e-9
        with nifake.Session('dev1') as session:
            session.read_write_double_with_converter = hightime.timedelta(nanoseconds=1)
            self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number))
github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime
        month = 12
        day = 30
        year = 1988
        hour = 10
        minute = 15
        self.side_effects_helper['GetCalDateAndTime']['return'] = 0
        self.side_effects_helper['GetCalDateAndTime']['month'] = month
        self.side_effects_helper['GetCalDateAndTime']['day'] = day
        self.side_effects_helper['GetCalDateAndTime']['year'] = year
        self.side_effects_helper['GetCalDateAndTime']['hour'] = hour
        self.side_effects_helper['GetCalDateAndTime']['minute'] = minute
        with nifake.Session('dev1') as session:
            last_cal = session.get_cal_date_and_time(0)
            assert isinstance(last_cal, hightime.datetime)
            assert hightime.datetime(year, month, day, hour, minute) == last_cal
github ni / nimi-python / generated / nifake / nifake / unit_tests / test_session.py View on Github external
def test_get_cal_date_time(self):
        self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime
        month = 12
        day = 30
        year = 1988
        hour = 10
        minute = 15
        self.side_effects_helper['GetCalDateAndTime']['return'] = 0
        self.side_effects_helper['GetCalDateAndTime']['month'] = month
        self.side_effects_helper['GetCalDateAndTime']['day'] = day
        self.side_effects_helper['GetCalDateAndTime']['year'] = year
        self.side_effects_helper['GetCalDateAndTime']['hour'] = hour
        self.side_effects_helper['GetCalDateAndTime']['minute'] = minute
        with nifake.Session('dev1') as session:
            last_cal = session.get_cal_date_and_time(0)
            assert isinstance(last_cal, hightime.datetime)
            assert hightime.datetime(year, month, day, hour, minute) == last_cal
github ni / nimi-python / src / niscope / examples / niscope_fetch_forever.py View on Github external
# 3. Configuring
        session.configure_horizontal_timing(min_sample_rate=sample_rate_in_hz, min_num_pts=1, ref_position=0.0, num_records=1, enforce_realtime=True)
        session.channels[channel_list].configure_vertical(voltage, coupling=niscope.VerticalCoupling.DC, enabled=True)
        # Configure software trigger, but never send the trigger.
        # This starts an infinite acquisition, until you call session.abort() or session.close()
        session.configure_trigger_software()
        current_pos = 0
        # 4. initiating
        with session.initiate():
            while current_pos < total_samples:
                # We fetch each channel at a time so we don't have to de-interleave afterwards
                # We do not keep the wfm_info returned from fetch_into
                for channel, waveform in zip(channel_list, waveforms):
                    # 5. fetching - we return the slice of the waveform array that we want to "fetch into"
                    session.channels[channel].fetch_into(waveform[current_pos:current_pos + samples_per_fetch], relative_to=niscope.FetchRelativeTo.READ_POINTER,
                                                         offset=0, record_number=0, num_records=1, timeout=hightime.timedelta(seconds=5.0))
                current_pos += samples_per_fetch
github ni / nimi-python / generated / nidmm / nidmm / _converters.py View on Github external
def convert_seconds_real64_to_timedelta(value):
    return hightime.timedelta(seconds=value)
github ni / nimi-python / generated / niscope / niscope / _converters.py View on Github external
def convert_month_to_timedelta(months):
    return hightime.timedelta(days=(30.4167 * months))

hightime

Hightime Python API

MIT
Latest version published 7 months ago

Package Health Score

62 / 100
Full package analysis

Popular hightime functions

Similar packages