text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
#!/usr/bin/env python3 """Standalone CLI to create a rawdata impression directly in Yuki storage. This bypasses the HTTP upload for very large datasets by copying data locally into the Yuki impression directory and creating matching metadata. """ import argparse import json import os import shutil import subprocess im...
CelebiProjects/Yuki
Yuki/cli/yuki_create_data.py
.py
95957070d65e772d
7
0
"""Classification of job output files into 'plot' vs 'data', plus a selection-spec predicate builder. Single source of truth for what counts as a plot, shared by collect filtering, booking filtering, and status views. """ import fnmatch import os PLOT_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".pdf", ".svg", ".we...
CelebiProjects/Yuki
Yuki/kernel/file_types.py
.py
b4fc5f79540cfca6
7
0
""" Performance benchmarks for buffer management systems. """ import threading import time from typing import Any import numpy as np import pytest from advanced_image_sensor_interface.utils.buffer_manager import AsyncBufferManager, BufferManager class BufferManagerBenchmarks: """Comprehensive benchmarks for bu...
muditbhargava66/Advanced-Image-Sensor-Interface
benchmarks/buffer_benchmarks.py
.py
cd763128fc388ace
7.3
3
""" Noise Analysis for Advanced Image Sensor Interface This module contains benchmark tests for analyzing noise characteristics and reduction efficacy in the Advanced Image Sensor Interface project. Functions: generate_noisy_image: Generate a synthetic noisy image for testing. measure_noise_level: Measure the...
muditbhargava66/Advanced-Image-Sensor-Interface
benchmarks/noise_analysis.py
.py
e2cc216689e405b6
7.3
3
#!/usr/bin/env python3 """ Performance Benchmarking Suite for Advanced Image Sensor Interface This script provides comprehensive performance benchmarking for all major components with realistic timing measurements and hardware-adjusted expectations. Usage: python benchmarks/performance_benchmark.py python ben...
muditbhargava66/Advanced-Image-Sensor-Interface
benchmarks/performance_benchmark.py
.py
934d60e02a6a2c75
7.3
3
""" Performance Benchmarks and Speed Tests This module provides realistic performance benchmarks for the Advanced Image Sensor Interface simulation framework. All measurements are clearly marked as simulation performance, not hardware throughput. Classes: PerformanceProfiler: Main class for performance profiling ...
muditbhargava66/Advanced-Image-Sensor-Interface
benchmarks/speed_tests.py
.py
45665e6e23856dbc
7.8
3
""" Advanced Integration Example for the Advanced Image Sensor Interface v2.0.0 This example demonstrates the enhanced features including: - Type-safe operations with comprehensive type annotations - Performance profiling and monitoring - Enhanced error handling with recovery strategies - USB3 Vision protocol support ...
muditbhargava66/Advanced-Image-Sensor-Interface
examples/advanced_integration_example.py
.py
e122039e972f6261
7.3
3
#!/usr/bin/env python3 """ Basic Usage Example for Advanced Image Sensor Interface This example demonstrates the fundamental usage patterns with proper error handling, input validation, and realistic parameter definitions. """ import argparse import logging import sys import numpy as np # Configure logging logging....
muditbhargava66/Advanced-Image-Sensor-Interface
examples/basic_usage.py
.py
09c3e75d1d2f320f
7.3
3
#!/usr/bin/env python3 """ Advanced Image Sensor Interface Comprehensive Demo This script demonstrates the enhanced features including: - Enhanced sensor interface with 8K support - HDR image processing - RAW image processing - Multi-sensor synchronization - GPU acceleration - Advanced power management Requirements: ...
muditbhargava66/Advanced-Image-Sensor-Interface
examples/comprehensive_demo.py
.py
cd1658bd1e5213cc
7.3
3
""" Advanced Integration Example for the Advanced Image Sensor Interface v2.0.0 This example demonstrates the enhanced features including: - Type-safe operations with comprehensive type annotations - Performance profiling and monitoring - Enhanced error handling with recovery strategies - USB3 Vision protocol support ...
muditbhargava66/Advanced-Image-Sensor-Interface
examples/integration_example.py
.py
20788ef01d60e1cb
7.3
3
""" Automated Testing Suite for Advanced Image Sensor Interface This script provides a comprehensive automated testing suite for the Advanced Image Sensor Interface project, including unit tests, integration tests, and performance benchmarks. Usage: python automated_testing.py [options] Options: --unit-tests...
muditbhargava66/Advanced-Image-Sensor-Interface
scripts/automated_testing.py
.py
92dce5f593433206
7.8
3
""" Data Analysis for Advanced Image Sensor Interface This script provides tools for analyzing simulation results and real-world test data from the Advanced Image Sensor Interface project. Usage: python data_analysis.py [options] <input_files> Options: --plot Generate plots for the analyze...
muditbhargava66/Advanced-Image-Sensor-Interface
scripts/data_analysis.py
.py
b7fee932bde4b1ee
7.3
3
""" Image Sensor Pipeline Simulation This script provides a comprehensive simulation of the Advanced Image Sensor Interface, including MIPI data transfer, signal processing, and power management. Usage: python simulation.py [options] Options: --resolution RESOLUTION Set the simulation resolution (default: ...
muditbhargava66/Advanced-Image-Sensor-Interface
scripts/simulation.py
.py
42d0027941f160fa
7.3
3
"""Version information for Advanced Image Sensor Interface.""" __version__ = "3.0.0" __version_info__ = (3, 0, 0) # Release information __title__ = "Advanced Image Sensor Interface" __description__ = "A comprehensive multi-protocol camera interface framework" __author__ = "Mudit Bhargava" __author_email__ = "muditbha...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/_version.py
.py
a3fc72606cbd90f0
7.3
3
""" Configuration Constants for Advanced Image Sensor Interface This module contains all configurable constants used throughout the system, replacing hardcoded magic numbers with named constants for better maintainability. """ import os import threading from dataclasses import dataclass, field from typing import Any ...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/config/constants.py
.py
dd11e56100c9d782
7.3
3
""" Circuit breaker pattern implementation for fault tolerance. """ import logging import time from collections.abc import Callable from enum import Enum from typing import Any logger = logging.getLogger(__name__) class CircuitBreakerState(Enum): """Circuit breaker states.""" CLOSED = "closed" OPEN = "...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/error_handling/circuit_breaker.py
.py
6f145bdd950f2a72
7.3
3
""" Comprehensive exception hierarchy for the Advanced Image Sensor Interface. Provides specific exception types for different error conditions with detailed error information and recovery hints. """ from dataclasses import dataclass from enum import Enum from typing import Any, Optional class ErrorSeverity(Enum): ...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/error_handling/exceptions.py
.py
5063cbd53da65b07
7.3
3
""" Error monitoring and analysis utilities. """ import logging import time from collections import defaultdict, deque from typing import Any logger = logging.getLogger(__name__) class ErrorMonitor: """Monitors and tracks errors.""" def __init__(self, history_size: int = 1000): """Initialize error ...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/error_handling/monitoring.py
.py
8b8c18062b6b28ff
7.3
3
""" Error recovery management and strategies. """ import logging from enum import Enum logger = logging.getLogger(__name__) class RecoveryStrategy(Enum): """Available recovery strategies.""" RETRY = "retry" FALLBACK = "fallback" RESTART = "restart" IGNORE = "ignore" class ErrorRecoveryManager...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/error_handling/recovery.py
.py
5abfbfc4c2b8bcd2
7.3
3
""" Retry mechanisms with configurable policies. """ import logging import random import time from collections.abc import Callable from dataclasses import dataclass from typing import Any logger = logging.getLogger(__name__) @dataclass class RetryPolicy: """Retry policy configuration.""" max_attempts: int ...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/error_handling/retry.py
.py
d0cdd957e9b2acd4
7.3
3
""" Caching utilities for performance optimization. """ import threading import time from collections import OrderedDict from typing import Any, Optional, TypeVar T = TypeVar("T") class LRUCache: """Least Recently Used cache implementation.""" def __init__(self, max_size: int = 128): """Initialize ...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/performance/cache.py
.py
1625dc6ff23a774f
7.3
3
""" Real-time performance monitoring for system resources and application metrics. """ import logging import threading import time from collections import deque from collections.abc import Callable from dataclasses import dataclass from typing import Any, Optional import psutil from ..types import Megabytes, Percent...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/performance/monitor.py
.py
b97982e6ec3b3b73
7.3
3
""" Performance optimization strategies and automatic tuning. """ import logging from dataclasses import dataclass from enum import Enum from typing import Any logger = logging.getLogger(__name__) class OptimizationStrategy(Enum): """Available optimization strategies.""" THROUGHPUT = "throughput" LATEN...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/performance/optimizer.py
.py
73f70c9a8287a2aa
7.3
3
""" Performance profiling utilities for identifying bottlenecks and optimization opportunities. """ import functools import logging import threading import time from collections.abc import Callable from dataclasses import dataclass, field from typing import Any, Optional, TypeVar import psutil from ..types import Pe...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/performance/profiler.py
.py
52e4f84c494515f9
7.3
3
""" Calibration data models and structures. This module defines the data structures used for camera calibration results, quality metrics, and calibration parameters. """ from dataclasses import dataclass from typing import Any, Optional import numpy as np @dataclass class CalibrationResult: """Results from cam...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/calibration/models.py
.py
3b73d4d971fbfd85
7.3
3
""" Neural network-based calibration parameter tuning. This module provides AI-based optimization of calibration parameters using neural networks to improve calibration accuracy and robustness. Uses scikit-learn MLPRegressor as a fallback for TensorFlow/PyTorch. """ import logging from dataclasses import dataclass f...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/calibration/neural_tuner.py
.py
1e3b993aa2aca9d3
7.3
3
"""Enhanced Sensor Interface for v2.0.0. This module provides enhanced sensor interface capabilities including: - Support for resolutions up to 8K (7680x4320) - HDR image processing - RAW format support - Multi-sensor synchronization - Advanced timing controls """ import logging import time from dataclasses import da...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/enhanced_sensor.py
.py
765de44803be4135
7.3
3
"""HDR Image Processing Pipeline. This module provides comprehensive HDR (High Dynamic Range) image processing capabilities including tone mapping, exposure fusion, and HDR reconstruction. """ import logging from dataclasses import dataclass from enum import Enum from typing import Optional import numpy as np logge...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/hdr_processing.py
.py
1ac44e4e8b37d83d
7.3
3
""" Image Validation and Processing Utilities This module provides comprehensive image validation, bit-depth handling, and safe processing operations for the Advanced Image Sensor Interface. Classes: ImageValidator: Validates image format, shape, and bit depth ImageProcessor: Safe image processing with automa...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/image_validation.py
.py
a5b10de7ffa1e8b2
7.3
3
""" MIPI CSI-2 Simulation for Advanced Image Sensor Interface This module provides the legacy MIPI CSI-2 driver for backward compatibility. For new code, use the protocol.mipi.driver.MIPIProtocolDriver instead. """ import asyncio import logging import threading import time import warnings from abc import abstractmeth...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/mipi_driver.py
.py
21c7500a5b8a4ce9
7.3
3
""" MIPI CSI-2 Protocol Implementation and Validation This module provides MIPI CSI-2 packet parsing, formatting, and validation capabilities for protocol compliance testing and simulation. Classes: MIPIPacket: Base class for MIPI CSI-2 packets ShortPacket: MIPI CSI-2 short packet implementation LongPacke...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/mipi_protocol.py
.py
214ea0e649a26bfa
7.3
3
""" Power Management Simulation for Advanced Image Sensor Interface This module implements a power management simulation for CMOS image sensors, modeling low-noise operation and efficient power delivery characteristics. IMPORTANT: This is a simulation model, not actual power management hardware. Power consumption val...
muditbhargava66/Advanced-Image-Sensor-Interface
src/advanced_image_sensor_interface/sensor_interface/power_management.py
.py
f4df03523ac704f6
7.3
3
"""Adjuster code, adjust forecast by last 7 days of ME""" import logging from datetime import datetime, timedelta from typing import Optional import pandas as pd import pvlib from pvsite_datamodel.read import get_site_by_uuid from pvsite_datamodel.sqlmodels import ( ForecastSQL, ForecastValueSQL, Generati...
openclimatefix/india-forecast-app
india_forecast_app/adjuster.py
.py
c6b608de14501737
7.35
4
""" Main forecast app entrypoint """ import asyncio import datetime as dt import logging import os import sys import click import pandas as pd import sentry_sdk from pvsite_datamodel import DatabaseConnection from pvsite_datamodel.read import get_sites_by_country from pvsite_datamodel.sqlmodels import LocationAssetTy...
openclimatefix/india-forecast-app
india_forecast_app/app.py
.py
b81fa065a1bd2ef8
7.35
4
"""Functions for retrieving and preparing generation data for forecasting.""" import asyncio import datetime as dt import logging import os import numpy as np import ocf.dp as dp import pandas as pd import pvlib from pvsite_datamodel import LocationSQL from pvsite_datamodel.read import get_pv_generation_by_sites from...
openclimatefix/india-forecast-app
india_forecast_app/data/generation.py
.py
a0542315035193a6
7.35
4
""" Dummy Model class (generate a dummy forecast) """ import datetime as dt import math import random import pandas as pd import pytz class DummyModel: """ Dummy model that emulates the capabilities expected by a real model """ @property def version(self): """Version number""" r...
openclimatefix/india-forecast-app
india_forecast_app/models/dummy.py
.py
0a685c71edb581f7
7.35
4
""" PVNet model class """ import datetime as dt import logging import os import shutil import tempfile import numpy as np import pandas as pd import torch from ocf_datapipes.batch import ( BatchKey, batch_to_tensor, copy_batch_to_device, stack_np_examples_into_batch, ) from ocf_datapipes.training.pvne...
openclimatefix/india-forecast-app
india_forecast_app/models/pvnet/model.py
.py
1670dc823ed82ec4
7.35
4
"""Useful functions for setting up PVNet model""" import logging import os from typing import Optional import fsspec import numpy as np import torch import xarray as xr import yaml from ocf_datapipes.batch import BatchKey from ocf_datapipes.config.model import NWP from ocf_datapipes.utils.consts import ELEVATION_MEAN...
openclimatefix/india-forecast-app
india_forecast_app/models/pvnet/utils.py
.py
4dbbdc975226d4a1
7.35
4
"""A pydantic model for the ML models""" from typing import List, Literal, Optional import fsspec from pyaml_env import parse_config from pydantic import BaseModel, Field class Model(BaseModel): """One ML Model""" name: str = Field(..., title="Model Name", description="The name of the model") type: Opt...
openclimatefix/india-forecast-app
india_forecast_app/models/pydantic_models.py
.py
b6880e98cb0a586d
7.35
4
"""Data Platform operations: location management, forecaster lifecycle, and forecast saving.""" from __future__ import annotations import asyncio import contextlib import json import logging import os import re from collections.abc import AsyncIterator # noqa: TC003 from datetime import UTC, datetime, timedelta from...
openclimatefix/india-forecast-app
india_forecast_app/save/data_platform.py
.py
23dfc808a3ed0c7b
7.35
4
"""Database operations for persisting forecasts.""" from __future__ import annotations import logging import pandas as pd # noqa: TC002 from pvsite_datamodel.write import insert_forecast_values from sqlalchemy.orm import Session # noqa: TC002 from india_forecast_app.adjuster import adjust_forecast_with_adjuster ...
openclimatefix/india-forecast-app
india_forecast_app/save/database.py
.py
fde997ae439843e0
7.35
4
"""Shared utility helpers used across the save subpackage.""" from __future__ import annotations from datetime import UTC, datetime import pandas as pd def add_or_convert_to_utc(timestamp: object) -> pd.Timestamp: """Ensure a timestamp is a timezone-aware UTC pd.Timestamp.""" ts = pd.Timestamp(timestamp) ...
openclimatefix/india-forecast-app
india_forecast_app/save/utils.py
.py
1331f7664dcaa539
7.35
4
""" Script for seeding a local DB. """ import os from pvsite_datamodel.connection import DatabaseConnection from pvsite_datamodel.sqlmodels import Base from pvsite_datamodel.write.user_and_site import ( create_site, ) def _confirm_action() -> bool: """ Provides opportunity for user to decide whether to ...
openclimatefix/india-forecast-app
scripts/seed_local_db.py
.py
b81123fbdfad95a2
7.35
4
"""Testing utils.""" import datetime as dt from datetime import UTC import pandas as pd from click.testing import CliRunner def run_click_script(func, args: list[str], catch_exceptions: bool = False): """Util to test click scripts while showing the stdout.""" runner = CliRunner() # We catch the except...
openclimatefix/india-forecast-app
tests/_utils.py
.py
0617717a8decb026
7.85
4
"""Tests for reading generation data from the Data Platform. Tests cover (all in data/generation.py): 1. energy_source_for_asset_type: "pv" maps to the SOLAR energy source 2. energy_source_for_asset_type: "wind" maps to the WIND energy source 3. fetch_generation_from_dp: value_fraction is converted to power_kw using c...
openclimatefix/india-forecast-app
tests/data/test_read_from_data_platform.py
.py
1473c490b77802c4
7.85
4
""" Tests for utils for pvnet""" import os import tempfile import numpy as np from ocf_datapipes.batch import BatchKey from india_forecast_app.models.pvnet.utils import save_batch, set_night_time_zeros def test_set_night_time_zeros(): """Test for setting night time zeros""" # set up preds (1,5,7) {example, ...
openclimatefix/india-forecast-app
tests/models/pvnet/test_utils.py
.py
99d9e96d6f58bf31
7.85
4
""" Test for getting all ml models""" from india_forecast_app.models.pydantic_models import get_all_models def test_get_all_models(): """Test for getting all models""" models = get_all_models() assert len(models.models) == 9 def test_get_all_models_client(): """Test for getting all models for a spec...
openclimatefix/india-forecast-app
tests/models/test_pydantic_models.py
.py
a1885e9b3091ee52
7.35
4
""" Tests for india_forecast_app.save.save (the save_forecast orchestrator). Tests cover: 1. write_to_db=False: nothing is persisted to the database 2. write_to_db=True: base forecast is written to the database 3. use_adjuster_database=True: both base and _adjust models are written 4. ml_model_name=None: adjuster is s...
openclimatefix/india-forecast-app
tests/save/test_save.py
.py
56a39a9c21ae88d4
7.85
4
""" Tests for india_forecast_app.save.utils. Tests cover: 1. add_or_convert_to_utc: naive datetime is localised to UTC 2. add_or_convert_to_utc: timezone-aware UTC datetime is returned unchanged 3. add_or_convert_to_utc: non-UTC timezone-aware datetime is converted to UTC 4. add_or_convert_to_utc: naive pandas Tim...
openclimatefix/india-forecast-app
tests/save/test_save_utils.py
.py
275c29eac244a090
7.85
4
""" Tests for functions in app.py """ import datetime as dt import multiprocessing as mp import os import uuid from unittest.mock import AsyncMock, MagicMock, patch import pandas as pd import pytest from pvsite_datamodel.sqlmodels import ForecastSQL, ForecastValueSQL, MLModelSQL from india_forecast_app.app import ( ...
openclimatefix/india-forecast-app
tests/test_app.py
.py
89c4716dc537bb2d
7.85
4
"""Bounded parallel execution of a target profile over many files, with honest reporting. Two deliberate departures from the code this replaces: * A bounded pool instead of one process per input file. Spawning N processes for N files oversubscribes the machine badly, since each one starts an ffmpeg that is itsel...
bhemsen/converter
converter/batch.py
.py
7b2ae70efa5cafee
7
0
"""Thin wrapper around the ``ffmpeg`` / ``ffprobe`` command-line programs. We shell out on purpose instead of using a wrapper library. ``ffmpeg-python`` has had no release since 2019, the PyPI package literally named ``ffmpeg`` is an unrelated stub that collides with it in ``site-packages/ffmpeg/``, and ``pydub`` imp...
bhemsen/converter
converter/ffmpegtool.py
.py
895b40c94b349135
7
0
"""Input discovery and output-path construction. Every path bug the old scripts had lived in these few functions, so they are kept pure and side-effect free -- which also makes them the part of the tool that is worth unit-testing. """ import errno import os from collections.abc import Iterable from pathlib import Pat...
bhemsen/converter
converter/paths.py
.py
6ee802d631f136cb
7
0
"""Run every machine check this project has, as one non-interactive command. The loopkit workflow contract needs a single Verify command, and the stack has three separate checks. Rather than chain them in a shell -- which would differ between PowerShell and sh, and which the CI matrix would then have to duplicate -- ...
bhemsen/converter
scripts/verify.py
.py
7d6a4f694bc3f956
7
0
ALLOWED_TAGS = ["h2", "p", "ol", "li", "span", "strong", "br", "s", "em", "u", "ul"] def filter_tags_and_attributes(soup): for tag in soup.find_all(True): if tag.name not in ALLOWED_TAGS: tag.decompose() else: tag.attrs = {"class": tag.get("class")} if tag.get("class") else...
betagouv/seves
core/html.py
.py
ab47ac2912f06736
7.35
4
""" ________/\\\\\\\\\_________________________/\\\\\_________________/\\\_________ _____/\\\////////______________________/\\\\////_________________\/\\\_________ ___/\\\/____________________________/\\\///___________/\\\_______\/\\\_________ __/\\\______________/\\\\\\\\\\___/\\\\\\\\\\\__...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/V.19.01.py
.py
896b1061ecaf79bb
7
0
""" V.20.01 """ #import import novapi from mbuild import power_manage_module from mbuild.encoder_motor import encoder_motor_class from mbuild import power_expand_board from mbuild import gamepad from mbuild.smartservo import smartservo_class from mbuild.ranging_sensor import ranging_sensor_class from mbuild....
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/V.20.01.py
.py
5bf6f14c7ff1a4a4
7
0
class button_class() : def __init__(self, PORT, INDEX): """ define the button module PORT, the port the senor is connected to on the novapi INDEX, the sensor number in the chain INDEX<1-10> """ def reset_count(): """reset button pressed count""" return ...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/button.py
.py
6f0b2d128bd963a5
7
0
class encoder_motor_class() : def __init__(self, port:str, index:str): """ initilize an encoder motor Port: M1,M2,M3,M4,M5,M6 Index, INDEX<no> (1-6) """ pass def set_power(self, power:int): """ Set encoder motor power by percent """ ...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/encoder_motor.py
.py
89c9b4b55dc42789
7
0
def get_joystick(joystick:str): """Get the joystick value, return value range , left positive and right negative, up positive and bottom negative, parameters:100 ~ -100 ``` { "Lx": "left x-axis", "Ly": "left y-axis", "Rx": "right x-axis", "Ry": "right y-axis" } ``` ...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/gamepad.py
.py
a9190f2eb42ad824
7
0
class led_matrix_class() : def __init__(self, PORT, INDEX): """ define the led matrix PORT, the port the senor is connected to on the novapi INDEX, the sensor number in the chain INDEX<1-10> """ def show_image(self, pattern, x, y, time_s = 1): """ show im...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/led_matrix.py
.py
a3319e3a98048304
7
0
class servo_driver_class: def __init__(self, PORT, INDEX): """ define the servo driver PORT, the port the senor is connected to on the novapi INDEX, the sensor number in the chain INDEX<1-10> """ pass def set_angle(self, angle:int): """set servo to an ang...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/servo_driver.py
.py
f917a0a21cfbca82
7
0
class smartservo_class() : def __init__(self, port:str, index:str): """ initilize an smart servo Port: M1,M2,M3,M4,M5,M6 Index, INDEX<no> (1-6) """ pass def set_power(self, power:int): """ Set smart servo power by percent """ ...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/mbuild/smartservo.py
.py
fef99f6321f57fb0
7
0
## Timer Module def timer(): "Get the system timer time in seconds." return 1 def reset_timer(): "Reset the system timer time." return 0 #Built in Gyro def get_pitch(): "Obtain the pitch angle (X axis) of the attitude angle, unit: °, the returned data range is-180 ~ 180" return 0 def get_roll...
RETOUTHz/MakeX-Resources24-26
2024CS6th/Program/novapi/__init__.py
.py
8fe300dd596b1401
7
0
""" V.20.01 """ #import import novapi from mbuild import power_manage_module from mbuild.encoder_motor import encoder_motor_class from mbuild import power_expand_board from mbuild import gamepad from mbuild.smartservo import smartservo_class from mbuild.ranging_sensor import ranging_sensor_class from mbuild....
RETOUTHz/MakeX-Resources24-26
2025CS6th/main.py
.py
ec7726febadb3b81
7
0
""" MakeSex 2026 """ import time import math import novapi import mbuild from mbuild import power_manage_module from mbuild import power_expand_board from mbuild import gamepad from mbuild.encoder_motor import encoder_motor_class from mbuild.smartservo import smartservo_class """ INITIALISATION """ en = { "LF"...
RETOUTHz/MakeX-Resources24-26
2026雷神(RAIJIN)/Program/RAI.py
.py
2f6feeba0f664f34
7
0
import csv import os def format_rating(score): return '⭐' * score + '☆' * (10 - score) + f' {score}/10' def replace_string_in_files(directory, target_string, replacement_string): """ Replaces all occurrences of target_string with replacement_string in all .md files within the specified directory. :p...
travel-in-books/travel-in-books.github.io
tools.py
.py
0ca32d0d9964642b
7.15
1
import logging from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor from sqlalchemy.orm import Session from models.model_db import ExecutionLog from scripts.async_thread import wait_for_thread_future from scripts.database import SessionLocal from scripts.execution_log_retention impor...
YusukeKato/ShellgeiOnlineJudge
backend/scripts/execution_log_persistence.py
.py
6bebe7cc9b559d23
7.24
2
""" HDF5 Timeseries Plotter - Interactive visualization tool Plots timeseries data from HDF5 recordings with interpretable Y-axis labels. Usage: python hdf5_timeseries_plotter.py <path_to_hdf5_file> Features: - Interactive plot selection - Proper Y-axis labels with units - Multiple subplots for different data ty...
s1alknau/Nematostella-time-series
hdf5_timeseries_plotter_v2.py
.py
d04abbe2b836120f
7
0
#!/usr/bin/env python3 """Collect Markdown docs into docs/ so MkDocs can serve them. The canonical source of these files stays where it is (GitHub/PyPI read the root README of each repo). MkDocs only builds files inside docs_dir, so we copy the relevant ones in before building. The copies are git-ignored. Sources: ...
s1alknau/Nematostella-time-series
scripts/sync_docs.py
.py
8646d898e1cb99fd
7
0
""" ROI Detector - HoughCircles-based well detection, identical algorithm to napari-hdf5-activity. """ from __future__ import annotations import logging from dataclasses import dataclass, field import numpy as np logger = logging.getLogger(__name__) try: import cv2 CV2_AVAILABLE = True except ImportError:...
s1alknau/Nematostella-time-series
src/timeseries_capture/Analysis/roi_detector.py
.py
ef42c2e4ec966ca2
7
0
""" Phase Manager - Day/Night Cycle Management Verantwortlich für: - Phase-Wechsel (Light <-> Dark) - Cycle Counting - LED Type Bestimmung pro Phase - Phase Timing """ import logging import time from typing import Optional from .recording_state import PhaseInfo, PhaseType, RecordingConfig logger = logging.getLogger...
s1alknau/Nematostella-time-series
src/timeseries_capture/Recorder/phase_manager.py
.py
b051e581a6835609
7
0
"""Lightweight package metadata and environment helpers for EQ.""" from __future__ import annotations import os import platform import subprocess import sys __version__ = '0.1.0' def _default_conda_environment() -> str: """Return the supported default conda env for the current host OS.""" override = os.env...
nicholas-camarda/endotheliosis-quantifier
src/eq/__init__.py
.py
df18c463cd0bb95f
7.15
1
"""Canonical filename parsing and validation for preeclampsia raw data.""" from __future__ import annotations import re from dataclasses import dataclass from pathlib import Path from typing import Iterable, Optional from eq.core.constants import IMAGE_EXTENSIONS, MASK_EXTENSIONS CANONICAL_SUBJECT_IMAGE_RE = re.com...
nicholas-camarda/endotheliosis-quantifier
src/eq/data_management/canonical_naming.py
.py
f43679582a7a5386
7.15
1
#!/usr/bin/env python3 """Current-namespace FastAI model loading utilities.""" from pathlib import Path from typing import Union # FastAI is required by design from fastai.vision.all import Learner, load_learner # type: ignore from eq.utils.logger import get_logger def load_mitochondria_model(model_path: str) -> ...
nicholas-camarda/endotheliosis-quantifier
src/eq/data_management/model_loading.py
.py
6278bb5dbdc4c9ef
7.15
1
#!/usr/bin/env python3 """Output directory management system for the endotheliosis quantifier pipeline.""" import json from datetime import datetime, timedelta from pathlib import Path from typing import Any, Dict, Optional, Union from eq.utils.logger import get_logger from eq.utils.paths import get_repo_root class...
nicholas-camarda/endotheliosis-quantifier
src/eq/data_management/output_manager.py
.py
35ebe089c7d68b62
7.15
1
"""MedSAM SAM subprocess runtime: device env and Python interpreter selection (MPS/CUDA).""" from __future__ import annotations import os import sys from pathlib import Path from typing import Any def medsam_subprocess_extra_env(*, device: str) -> dict[str, str]: """Environment variables merged into MedSAM SAM ...
nicholas-camarda/endotheliosis-quantifier
src/eq/evaluation/medsam_torch_runtime.py
.py
18a2a9f54f6a5bed
7.15
1
#!/usr/bin/env python3 """ GPU-Optimized Glomeruli Inference This module provides fast, GPU-optimized inference for glomeruli segmentation models using your RTX 3080. Bypasses FastAI's broken inference pipeline and uses direct PyTorch calls for maximum performance. """ from pathlib import Path from typing import Dict...
nicholas-camarda/endotheliosis-quantifier
src/eq/inference/gpu_inference.py
.py
e60307632ff30e05
7.15
1
from pathlib import Path import tifffile def _extract_tif_stack(tif_path: Path, output_dir: Path, prefix: str): """Extract individual images from a TIF stack.""" print(f"📦 Extracting TIF stack: {tif_path}") # Read the TIF stack with tifffile.TiffFile(tif_path) as tif: # Get the number o...
nicholas-camarda/endotheliosis-quantifier
src/eq/processing/image_mask_preprocessing.py
.py
c831f58a1e3285a8
7.15
1
from ..core.bumper_base import BumperBase from .semantic import SemanticBumper, SemanticCommitBumper _bumpers = {SemanticBumper.name: SemanticBumper, SemanticCommitBumper.name: SemanticCommitBumper} def register_bumper(bumper_class: type[BumperBase]) -> type[BumperBase]: """ Register a bumper class in the gl...
jdraines/vertagus
src/vertagus/bumpers/registry.py
.py
2d481ab5956c043b
7
0
import re from packaging import version as versionmod from ..core.bumper_base import BumperBase, BumperException from ..core.scm_base import ScmBase class SemverBumperException(BumperException): pass class NoLevelSpecified(SemverBumperException): pass class SemanticBumper(BumperBase): """ Bumper...
jdraines/vertagus
src/vertagus/bumpers/semantic.py
.py
2040519632f7a002
7
0
import copy import os import sys from pathlib import Path import click import yaml from vertagus.configuration import from_cli, load from vertagus.configuration import types as cfgtypes from vertagus.errors import ConfigurationError def get_cwd() -> Path: return Path(os.getcwd()) def validate_config_path(conf...
jdraines/vertagus
src/vertagus/cli/utils.py
.py
9e69130e3a36fa39
7
0
"""Build a vertagus configuration from CLI options, without a configuration file. The CLI can assemble the same :class:`~vertagus.configuration.types.MasterConfig` mapping that :mod:`vertagus.configuration.load` reads from disk, so that commands work identically whether their settings came from ``vertagus.yaml`` or fr...
jdraines/vertagus
src/vertagus/configuration/from_cli.py
.py
5c9bea24c476ef28
7
0
from .tag_base import AliasBase, Tag class ScmBase: scm_type = "base" tag_prefix: str | None = None def __init__( self, root: str | None = None, version_strategy: str | None = "tag", target_branch: str | None = None, manifest_path: str | None = None, manife...
jdraines/vertagus
src/vertagus/core/scm_base.py
.py
6ea2fa42968a987e
7
0
"""Shared machinery for updating a manifest's version without rewriting the whole file.""" import typing as T from logging import getLogger logger = getLogger(__name__) class InPlaceVersionWriter: """Writes a new version into a manifest by editing the text of the file. Serializing a parsed document back to...
jdraines/vertagus
src/vertagus/providers/manifest/in_place.py
.py
62c7478b3c0d21e8
7
0
"""Edit a single value in a TOML document without disturbing the rest of it. Serializing a parsed TOML document back to text loses everything the parser threw away: comments, blank lines, key order, and the author's choice of quoting and indentation. That is an unacceptable trade for a version bump, which changes a ha...
jdraines/vertagus
src/vertagus/providers/manifest/toml_edit.py
.py
29d271dd8ff176a1
7
0
from typing import Any from pyutils.strings.transformers import camel_to_snake def camel_to_snake_dict(camel_dict: dict[str, Any]) -> dict[str, Any]: """ Converts a dictionary's keys from camel case to snake case. :param camel_dict: dictionary with camel case keys :return: dictionary with snake case...
iagocanalejas/pyutils
pyutils/dicts/utils.py
.py
0d34a1054efe7360
7
0
from datetime import date, datetime, timedelta def week_to_date(week: int, year: int) -> datetime: """ Return datetime for the given week, year. (https://stackoverflow.com/a/17087427) :param week: number :param year: number :return: datetime """ return datetime.fromisocalendar(year, week,...
iagocanalejas/pyutils
pyutils/shortcuts/dates.py
.py
823d194c6425675d
7
0
import random import uuid def generate_unique_code(length: int = 8) -> str: """ :return: Generated 'length' length hexadecimal number """ return uuid.uuid4().hex[:length].upper() _USER_AGENTS = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.1...
iagocanalejas/pyutils
pyutils/shortcuts/utils.py
.py
476401c50adea8b7
7
0
import re def split_money(value: str) -> tuple[str | None, float | None]: """ Splits a money string into (currency, amount). Works with various formats like: - "$100" - "USD 100.50" - "100 EUR" - "€99.99" - "AUD1200.75" Returns: (currency: str | None, amount: float ...
iagocanalejas/pyutils
pyutils/strings/money.py
.py
bc682d3586e923c7
7
0
def match_normalization(text: str, normalization_rules: dict[str, list[list[str]]]) -> str: """ Applies normalization rules to the input text based on provided patterns. Parameters: text (str): The input text to be normalized. normalization_rules (dict[str, list[list[str]]]): A dictionary c...
iagocanalejas/pyutils
pyutils/strings/normalize.py
.py
fc24e722d149bf38
7
0
import re def find_roman(word: str) -> str | None: """ Checks if a word is a valid Roman numeral. :param word: The input string. :return: The word itself if it's a valid Roman numeral, otherwise None. """ roman_pattern = r"^M{0,3}(CM|CD|D?C{0,3})?(XC|XL|L?X{0,3})?(IX|IV|V?I{0,3})?$" retur...
iagocanalejas/pyutils
pyutils/strings/roman.py
.py
fcb8e4540fed3f66
7
0
from difflib import SequenceMatcher def levenshtein_distance(s1: str, s2: str) -> float: """ :return: Levenshtein distance between two strings """ # Create a matrix with dimensions (len(s1) + 1) x (len(s2) + 1) matrix = [[0] * (len(s2) + 1) for _ in range(len(s1) + 1)] # Initialize the first ...
iagocanalejas/pyutils
pyutils/strings/similarity.py
.py
6614e8a732b29245
7
0
import re CAMEL_TO_SNAKE = re.compile(r"((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z])|(?<=[a-zA-Z])[0-9])") def camel_to_snake(camel_str: str) -> str: """ Transforms a camelcase string into a snakecase one. """ snake_str = CAMEL_TO_SNAKE.sub(r"_\1", camel_str) return snake_str.lower() def int_to_euro...
iagocanalejas/pyutils
pyutils/strings/transformers.py
.py
64710ff52bd0bf27
7
0
import string from typing import Any # Dictionary of ISO country code to IBAN length. # # The official IBAN Registry document is the best source for up-to-date information about IBAN formats and which # countries are in IBAN. # # https://www.swift.com/standards/data-standards/iban # # The IBAN_COUNTRY_CODE_LENGTH dict...
iagocanalejas/pyutils
pyutils/validators/bank.py
.py
9c0747eb92f6e171
7
0
tabla = "TRWAGMYFPDXBNJZSQVHLCKE" external = "XYZ" external_map = {"X": "0", "Y": "1", "Z": "2"} numbers = "1234567890" def is_valid_dni(dni: str) -> bool: """ :return: True if the DNI is valid """ if len(dni) == 9: dig_control = dni[8] dni = dni[:8] if dni[0] in external: ...
iagocanalejas/pyutils
pyutils/validators/dni.py
.py
d7f07ec8954eacf6
7
0
#!/usr/bin/env python3 """PreToolUse hook: hard-block Workflow launches that violate the project's model-tiering cap (CLAUDE.md, "Orchestration: model & effort tiering"). Rule: at most ~3 top-tier (inherit-model) agent() calls per workflow script; every other agent() call must carry a cheap model override (model:'sonn...
JasperSeehofer/darksiren-emri
.claude/hooks/workflow-tier-lint.py
.py
de5e7403c143e799
7.15
1
"""N-2 measurement M2: offline 2D-inertness check. Spec (N2_SELECTION_NUMERATOR_DERIVATION_20260805.md.DRAFT section 3.1 / 6.4 M2 / 6.3 P-4): verify offline that adding the derived selection factor S_4D to the 2D completion numerator changes the 2D per-event ln-likelihood by an h-INDEPENDENT per-event constant (i.e. z...
JasperSeehofer/darksiren-emri
.planning/derivation-gfrac-20260805/n2_m2_2d_inertness.py
.py
8c5ad325fdd2c082
7.15
1
"""Driver for all book data generators. Auto-discovers every ``gen_ch*.py`` / ``gen_museum*.py`` module in this directory and runs each one's ``main() -> None`` in sorted (chapter) order. Chapter agents therefore NEVER edit this file: dropping a correctly named generator into ``book/generators/`` is registration. Eac...
JasperSeehofer/darksiren-emri
book/generators/make_all.py
.py
ae854ff37da1b26f
7.15
1
#!/usr/bin/env python3 """Extract and compare pre-fix vs post-fix posterior values. Run from the project root after `quick_validation.sh` completes: python3 cluster/extract_validation_results.py Reads posterior JSON files from simulations/posteriors/ and simulations/posteriors_with_bh_mass/ and prints a compariso...
JasperSeehofer/darksiren-emri
cluster/extract_validation_results.py
.py
50ce77da2db47964
7.15
1