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 |
|---|---|---|---|---|---|---|
# Copyright 2026 Fictionlab sp. z o.o.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, d... | LeoRover/leo_robot-ros2 | leo_fw/leo_fw/versions.py | .py | ea05926f8eb87f43 | 7.52 | 10 |
from typing import Callable
from contextlib import contextmanager # context managers
import numpy as np
import threading
class ClassGlobalOptions:
multithreading: bool = True
"""enable/disable multithreading in the backend. For the GUI threading is always enabled"""
show_progress_bar: bool = True
... | drocheam/optrace | optrace/global_options.py | .py | 7af14b340011fd46 | 7.45 | 7 |
from __future__ import annotations
from typing import Any
import numpy as np
from traitsui.api import View, Item, ValueEditor, Group
from traits.api import HasTraits, observe, Button, Dict, Str
from traits.observation.api import TraitChangeEvent
from ..tracer.presets import spectral_lines as spec_lines
from ..tracer.... | drocheam/optrace | optrace/gui/property_browser.py | .py | 1f19c205c8022d09 | 7.45 | 7 |
from pyface.qt import QtGui
from traits.api import Instance
from traitsui.api import Editor, BasicEditorFactory
from pyvistaqt import QtInteractor
class _PyVistaEditor(Editor):
"""
Qt-based editor that embeds PyVistaQt.
"""
def init(self, parent):
"""
Create the QtInteractor control ... | drocheam/optrace | optrace/gui/pyvista_editor.py | .py | 837f7acebbc996db | 7.45 | 7 |
import copy
import numpy as np
import scipy.optimize
import matplotlib.pyplot as plt
from ..tracer.refraction_index import RefractionIndex
from ..tracer.geometry import Surface
from ..tracer.presets import spectral_lines as Lines
from ..property_checker import PropertyChecker as pc
from ..warnings import warning
fro... | drocheam/optrace | optrace/plots/misc_plots.py | .py | 30549b867999b071 | 7.45 | 7 |
import numpy as np
import matplotlib.pyplot as plt
from ..tracer import color as mcolor
from ..tracer.spectrum import Spectrum, LightSpectrum
from ..tracer.refraction_index import RefractionIndex
from .misc_plots import _show_grid, _save_or_show
from ..property_checker import PropertyChecker as pc
from ..global_opti... | drocheam/optrace | optrace/plots/spectrum_plots.py | .py | dc87d778c309b0a4 | 7.95 | 7 |
#!/usr/bin/env python3
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
import sys
import click
import datetime
import shutil
import subprocess
import os
import re
import pandas as pd
from pathlib import Path
from cellqc import __version__
def runcmd(cmdstr):
try:
cmdstr=' '.join(c... | lijinbio/cellqc | cellqc/cli.py | .py | 7fe824b3cf516262 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Assemble everything both reports show, from the files the workflow wrote.
The HTML report and the PDF slide deck call this and nothing else, so the two
cannot drift into describing different runs. Nothing here recomputes an
analysis: e... | lijinbio/cellqc | cellqc/reportdata.py | .py | 09acbb68128ad518 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Barcode rank ("knee") plot from the raw Cell Ranger matrix.
Purely diagnostic: cellqc does not call cells, it uses Cell Ranger's EmptyDrops
call. The plot exists so the separation between cells and empty droplets can be
judged by eye, ... | lijinbio/cellqc | cellqc/scripts/barcoderank.py | .py | acf23f05ebff9734 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Filter cells on total UMI, detected genes and mitochondrial percentage.
scanpy replacement for the Seurat implementation in v0.1.0. The three criteria
are unchanged, so thresholds carry over and cell counts are directly comparable:
S... | lijinbio/cellqc | cellqc/scripts/filterbycount.py | .py | 41c3a706897bd03f | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Apply the doublet calls and write the QC'd matrix.
Every caller listed in `doublet.run` contributes its score and class to .obs
under a namespaced column, but only `doublet.decider` removes cells. Keeping the
decision with one caller a... | lijinbio/cellqc | cellqc/scripts/filterdoublet.py | .py | efa9c149d73988f8 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Nuclear fraction per cell barcode, from the Cell Ranger BAM.
nuclear_fraction = n_intronic / (n_intronic + n_exonic)
This reimplements DropletQC::nuclear_fraction_tags(), whose only dependency was
a GitHub-only R package. Two deliber... | lijinbio/cellqc | cellqc/scripts/nuclear_fraction.py | .py | 5e88c8e210efe283 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Post-processing for downstream integration. Writes the final matrix.
Prefixes the cell barcode with the sample ID, makes var names unique, drops the
`raw` layer, and attaches the nuclear fraction when it was computed. The nuclear
fract... | lijinbio/cellqc | cellqc/scripts/postproc.py | .py | 52fb1dd88472a636 | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Self-contained HTML QC report.
Every figure is inlined as a base64 data URI so the file can be emailed or
archived on its own. PNG twins are used here because an <img> cannot render the
vector PDFs; the PDFs go into the slide deck.
"""... | lijinbio/cellqc | cellqc/scripts/qcreport.py | .py | a85a727bd08cad1d | 7.52 | 10 |
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
"""Presentation-ready PDF slide deck, rendered from a Jinja2 LaTeX template and
compiled with tectonic.
The template loops over the sample table and over a declared figure list, so a
new sample needs no template edit and a missing optiona... | lijinbio/cellqc | cellqc/scripts/slidereport.py | .py | 7f1d0733f1874bc3 | 7.52 | 10 |
"""Module containing SectionHandler parent class."""
import logging
# pylint: disable=too-few-public-methods
class SectionHandler:
"""
A class encapsulating arbitrary XML element in the tree.
After conversion, it holds the JSON structure of its whole subtree.
Attributes:
csaf The CSAF int... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/common/common.py | .py | 57f37bb079e63767 | 7.5 | 9 |
"""Module containing various helper functions."""
import json
import logging
import os
import re
import sys
from pathlib import Path
from datetime import datetime, timezone
from importlib.resources import files
import yaml
from .common import SectionHandler
def critical_exit(msg, status_code=1):
""" A critical... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/common/utils.py | .py | cd6d92f41d98e7ef | 7.5 | 9 |
""" Module containing DocumentLeafElements class """
import logging
from ..common.common import SectionHandler
# pylint: disable=too-few-public-methods
class DocumentLeafElements(SectionHandler):
"""
A handler for the document leaf elements which do not have any further children elements
handling CSAF pa... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/section_handlers/document_leaf_elements.py | .py | cd586c97104f2544 | 7.5 | 9 |
""" Module containing DocumentPublisher class """
from ..common.common import SectionHandler
# pylint: disable=too-few-public-methods
class DocumentPublisher(SectionHandler):
""" Responsible for converting the DocumentPublisher section:
- /cvrf:cvrfdoc/cvrf:DocumentPublisher
"""
type_category_mappi... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/section_handlers/document_publisher.py | .py | c54beefc5fccf698 | 7.5 | 9 |
""" Module containing Notes class """
import logging
from ..common.common import SectionHandler
# pylint: disable=too-few-public-methods
class Notes(SectionHandler):
""" Responsible for converting the Notes sections:
- /cvrf:cvrfdoc/cvrf:DocumentNotes
- /cvrf:cvrfdoc/vuln:Vulnerability[i+1]/vuln:Notes... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/section_handlers/notes.py | .py | 0be693010233f14c | 7.5 | 9 |
""" Module containing References class """
import logging
from ..common.common import SectionHandler
# pylint: disable=too-few-public-methods
class References(SectionHandler):
""" Responsible for converting the References sections:
- /cvrf:cvrfdoc/cvrf:DocumentReferences
- /cvrf:cvrfdoc/vuln:Vulnerabili... | csaf-tools/CVRF-CSAF-Converter | cvrf2csaf/section_handlers/references.py | .py | a49b70567b513fb6 | 7.5 | 9 |
"""
Minimal test for the Validator class
"""
from json import load
from pathlib import Path
from cvrf2csaf.validate import Validator
MINIMAL_DOCUMENT = {
"document": {
"csaf_version": "2.0",
"category": "category",
"title": "title",
"publisher": {
"category": "vendor",... | csaf-tools/CVRF-CSAF-Converter | tests/test_cvrf_full/test_validator.py | .py | 7a4eb050cd287895 | 8 | 9 |
import csv
import torch
import numpy as np
# Function to write metrics to CSV
def write_metrics_to_csv(metrics, csv_file, write_header=True):
"""
Write training and validation metrics to a CSV file.
Parameters:
- metrics (list of dict): List of dictionaries containing epoch, train_loss, train_acc, va... | ADALabUCSD/DeepPostures | CHAP2/util/chap_utils.py | .py | 1d97f6a8c2f32a48 | 7.57 | 13 |
import torch
from scipy.linalg import sqrtm
def intercovariance(views):
'''
Input: views(tensor): # batch_size, num_patch, patch_dim
Output: covariance_matrix(tensor): # batch_size, num_patch, num_patch
'''
# batch_size = views.shape[0]
# num_p = views.shape[1]
patch_dim = views.shape... | ADALabUCSD/DeepPostures | CHAP2/util/correlation.py | .py | b4c39db291f8bc7a | 7.57 | 13 |
# import numpy as np
# from scipy.linalg import sqrtm
# def intercovariance(views):
# if not isinstance(views, np.ndarray):
# views = np.array(views, dtype=np.float32)
# # Compute the pairwise covariance matrix
# num_p = views.shape[0]
# covariance_matrix = np.zeros((num_p, num_p))
# ... | ADALabUCSD/DeepPostures | CHAP2/util/covariance.py | .py | 3ffada6b44849f71 | 7.57 | 13 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
from torchvision import transforms
from torchvision.transforms import functional as F
class R... | ADALabUCSD/DeepPostures | CHAP2/util/crop.py | .py | fc3594cea39ba3ca | 7.57 | 13 |
import torch
from torch.utils.data import Dataset, DataLoader
import os
import numpy as np
import pickle
import torch
import torch.nn.functional as F
from scipy.signal import resample
from transforms3d.axangles import axangle2mat
from einops import rearrange
def rotation_axis(sample):
"""
Rotate the input sam... | ADALabUCSD/DeepPostures | CHAP2/util/datasets.py | .py | ffeb0f415212eb92 | 7.57 | 13 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class BinaryFocalLoss(nn.Module):
"""
Focal loss for binary classification with logits.
Args
----
alpha : float, default 0.25
Weight for the positive class. Set to None to disable class balancing.
gamma : float, d... | ADALabUCSD/DeepPostures | CHAP2/util/loss.py | .py | 7b953a90d75f067d | 7.57 | 13 |
import torch
import torch.nn as nn
from timm.models.layers import to_2tuple
#from util.pos_embed import tAPE
from einops import rearrange
class PatchEmbed_ts(nn.Module):
""" Flexible Image to Patch Embedding
"""
def __init__(self, ts_len=200,
patch_size=20,
embed_dim=512... | ADALabUCSD/DeepPostures | CHAP2/util/patch_embed.py | .py | 64a16f9b86c8faeb | 7.57 | 13 |
import matplotlib.pyplot as plt
import numpy as np
def min_max_normalize(data):
"""Min-max normalize a numpy array."""
return (data - np.min(data)) / (np.max(data) - np.min(data))
def mean_std_normalize(data):
"""Mean and standard deviation normalize a numpy array."""
return (data - np.mean(data)) / n... | ADALabUCSD/DeepPostures | CHAP2/util/plot_util.py | .py | a062de1c99e4e422 | 7.57 | 13 |
import csv
import torch
# Function to write metrics to CSV
def write_metrics_to_csv(metrics, csv_file):
"""
Write training and validation metrics to a CSV file.
Parameters:
- metrics (list of dict): List of dictionaries containing epoch, train_loss, train_acc, val_loss, and val_acc.
- csv_file (str... | ADALabUCSD/DeepPostures | MSSE-2021/utils.py | .py | 8019a90459fa1883 | 7.57 | 13 |
from typing import Generator
from GGTestUtils import sleep_with_log
from pytest import fixture, mark
from src.IoTUtils import IoTUtils
from src.GGTestUtils import GGTestUtils
from src.SystemInterface import SystemInterface
import time
import src.GGLSetup as ggl_setup
@fixture(scope="function")
def gg_util_obj(reques... | aws-greengrass/aws-greengrass-testing | src/aws-greengrass-testing-runtime.py | .py | 194bccfd555fa885 | 7.07 | 13 |
import argparse
import matplotlib.pyplot as plt
from matplotlib.axes import Axes
import numpy as np
import pathlib
import time
import jax
import jax.numpy as jnp
from jax import random
from jaxtyping import PRNGKeyArray
import apebench
from torch.utils.data import BatchSampler, DataLoader, RandomSampler, SequentialSam... | WilsonGregory/ginjax | scripts/burgers_anyd.py | .py | 880e83a0401b740b | 7.42 | 6 |
import argparse
import h5py
import numpy as np
import pathlib
import time
from typing_extensions import Self
import jax.numpy as jnp
import jax
import jax.random as random
from jaxtyping import PRNGKeyArray
from torch.utils.data import BatchSampler, DataLoader, RandomSampler, SequentialSampler
import ginjax.geometric... | WilsonGregory/ginjax | scripts/cfd_anyd.py | .py | ae946464347da4c8 | 7.42 | 6 |
# generate gravitational field
from __future__ import annotations
import time
from typing_extensions import Self
import jax.numpy as jnp
import jax.random as random
import jax
import equinox as eqx
import ginjax.geometric as geom
import ginjax.ml as ml
import ginjax.models as models
def get_1d_sine_data(
N: int... | WilsonGregory/ginjax | scripts/exploratory/compatibility_rescale_check.py | .py | 1551463bbd52e7ce | 7.42 | 6 |
import time
import argparse
import functools
import numpy as np
from typing_extensions import Callable, Optional
import jax.numpy as jnp
import jax
import jax.random as random
from jaxtyping import ArrayLike
import optax
import equinox as eqx
import ginjax.geometric as geom
import ginjax.ml as ml
import ginjax.models... | WilsonGregory/ginjax | scripts/exploratory/gradient_sphere.py | .py | a8880c8a439fb8e6 | 7.42 | 6 |
from __future__ import annotations
import argparse
import math
import pathlib
import time
import jax
import jax.numpy as jnp
import jax.random as random
from torch.utils.data import BatchSampler, DataLoader, RandomSampler, SequentialSampler
import ginjax.geometric as geom
import ginjax.ml as ml
import ginjax.models a... | WilsonGregory/ginjax | scripts/heat_equation.py | .py | fbaa7f5b0b9e8b86 | 7.42 | 6 |
import sys
import os
import time
import argparse
import numpy as np
import h5py
import matplotlib.pyplot as plt
from typing import Optional, Union
import jax.numpy as jnp
import jax
import jax.random as random
from jaxtyping import ArrayLike
import optax
import equinox as eqx
import ginjax.geometric as geom
import gi... | WilsonGregory/ginjax | scripts/supernova.py | .py | 08520d59cc678f21 | 7.42 | 6 |
import itertools as it
import numpy as np
from typing_extensions import Sequence
import enum
import jax.numpy as jnp
TINY = 1.0e-5
LETTERS = "abcdefghijklmnopqrstuvwxyxABCDEFGHIJKLMNOPQRSTUVWXYZ"
@enum.unique
class FilterScaling(enum.Enum):
NORMALIZE = enum.auto()
ONE = enum.auto()
GAUSSIAN = enum.auto(... | WilsonGregory/ginjax | src/ginjax/geometric/constants.py | .py | c90bedd9a823d3b2 | 7.42 | 6 |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.axes
import matplotlib.colors
import matplotlib.figure
from matplotlib.collections import PatchCollection
from matplotlib.patches import Arrow, Circle, Wedge
import argparse
from typing_extensions import Any, Optional, Union
import ... | WilsonGregory/ginjax | src/ginjax/utils.py | .py | 7924252c9664055a | 7.42 | 6 |
"""A NON-PLANAR equidistant closest-point curve: the general "Pull" tracer.
Every closest-point set lies on the sphere of radius d_min about the query,
but it need NOT be a circle. This example constructs an exact witness:
* take a non-planar rational spherical curve γ(u) — the stereographic image
of a PARABOLA (st... | contextmachine/mmcore | examples/closest_point/nonplanar_equidistant_band.py | .py | 7dcfc8c7ff024f8a | 7.48 | 8 |
"""Budget/status contract gate for bez_ssx5 (ledger L52; review doc §11 step 5).
Institutionalizes the 2026-07-12 review probes: every registered coverage
case is solved TWICE and validated against the schema-v2 contract —
1. schema presence: ``branches / points / singularities / overlap_regions /
complete / s... | contextmachine/mmcore | examples/ssx/bez_ssx5_budget_contract.py | .py | 258bb9c7525f6f96 | 7.48 | 8 |
"""case 15 (ledger L25, 2026-07-12): edge-graze — transversal arc hugging a domain edge.
S1 is the graph of z(s,t) = h*s - c*(t - t_star)^2 - h*d0 over (s,t) in [0,1]^2 —
an exact degree-(1,2) Bezier patch. S2 is the plane z=0. The true SSI is the
parabola
s(t) = (c/h) * (t - t_star)^2 + d0, xyz = (s, t, 0), ... | contextmachine/mmcore | examples/ssx/bez_ssx5_case15.py | .py | d74ab2de265c26e2 | 7.48 | 8 |
"""Dump the Bernstein-coefficient min/max of each TΨᵢ for every cell in
case 5's decomposition, alongside the interval T_box(B) evaluation that
`_check_tangency` uses. This tells us how close TΨᵢ is to definite sign
per cell — i.e. how close case 5 is to satisfying monotonicity.
"""
from __future__ import annotations
... | contextmachine/mmcore | examples/ssx/bez_ssx5_cert_ranges.py | .py | f4a89dd4ff6510e3 | 7.48 | 8 |
"""Diagnostic: record per-cell loop-absence certificate outcomes on Case 5.
For each cell in the subdivision tree we log:
- depth
- which TΨᵢ (if any) is definite-sign, else the four min/max ranges
- whether Gauss-map separability succeeded
- whether Krawczyk tangency was attempted and what it returned
- wha... | contextmachine/mmcore | examples/ssx/bez_ssx5_cert_trace.py | .py | 1ec57768dfada072 | 7.48 | 8 |
# -*- coding: utf-8 -*-
"""
This module provides a high-level interface for liquid handling operations, including aspirating, dispensing, and tip management.
## Classes:
`LiquidMover`: High-level interface for liquid handling operations
<i>Documentation last updated: 2025-06-11</i>
"""
# Standard library impo... | kylejeanlewis/control-lab-ly | controllably/Compound/LiquidMover/liquidmover.py | .py | b86bde7687d094e6 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module contains the HeaterMixin class.
Attributes:
TOLERANCE (float): tolerance for temperature
## Classes:
`HeaterMixin`: Mixin class for heater control
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard library imports
from __future__ import annotations
im... | kylejeanlewis/control-lab-ly | controllably/Make/Heat/heater_mixin.py | .py | ee1bed8122452a12 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module holds the Peltier class.
Attributes:
MAX_LEN (int): maximum length of buffer
READ_FORMAT (str): read format
TempData (NamedTuple): temperature data
## Classes:
`Peltier`: Peltier class
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard Library im... | kylejeanlewis/control-lab-ly | controllably/Make/Heat/peltier.py | .py | 9cf0f8ee7c295ce3 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module contains the LED class.
## Classes:
`LED`: LED class
`Multi_LED`: Multi-channel LED class
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard Library imports
from __future__ import annotations
import logging
import threading
# Local application imports
fro... | kylejeanlewis/control-lab-ly | controllably/Make/Light/led.py | .py | cb315fc8803afb5d | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""This module holds the references for QInstruments firmware."""
# Standard library imports
from enum import Enum
class ELMStateCode(Enum):
es0 = "ELM is moving"
es1 = "ELM is locked"
es3 = "ELM is unlocked"
es9 = "ELM error occurred"
class ELMStateString(Enum)... | kylejeanlewis/control-lab-ly | controllably/Make/Mixture/QInstruments/qinstruments_api/qinstruments_lib.py | .py | 5e9ac94bc2d7ac21 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module contains the TwoMagStirrer class, which is a wrapper for the TwoMagDevice class.
## CLasses:
`TwoMagStirrer`: A class that wraps the TwoMagDevice class and provides a higher level of abstraction for the 2Mag stirrer.
<i>Documentation last updated: 2025-02-22</i>
"""
# S... | kylejeanlewis/control-lab-ly | controllably/Make/Mixture/TwoMag/twomag.py | .py | ad61c24523628797 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module holds the API for the 2Mag device.
Attributes:
READ_FORMAT (str): The read format for the device
WRITE_FORMAT (str): The write format for the device
Data (NamedTuple): The data type for the device
## Classes:
`TwoMagDevice`: Class for the 2Mag device
<i>Doc... | kylejeanlewis/control-lab-ly | controllably/Make/Mixture/TwoMag/twomag_api/twomag_api.py | .py | bec6b2af46399148 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module holds the spinner class.
## Classes:
`Spinner`: Spinner class
`Multi_Spinner`: Ensemble of spinner tools
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard Library imports
from __future__ import annotations
import threading
# Local application imports
fro... | kylejeanlewis/control-lab-ly | controllably/Make/ThinFilm/spinner.py | .py | dfc0fe0cc21e3d02 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module contains the VacuumMixin class.
Attributes:
VACUUM_ON_DELAY (int): delay for vacuum on
VACUUM_OFF_DELAY (int): delay for vacuum off
## Classes:
`VacuumMixin`: Mixin class for vacuum control
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard library im... | kylejeanlewis/control-lab-ly | controllably/Make/Vacuum/vacuum_mixin.py | .py | 084494fad1e51d4f | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module holds the base class for maker tools.
## Classes:
`Maker`: Base class for maker tools
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard library imports
from __future__ import annotations
from copy import deepcopy
import logging
from types import SimpleNamespa... | kylejeanlewis/control-lab-ly | controllably/Make/make.py | .py | d7e098a0083eb232 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module provides a class for the Sentron pH meter.
Attributes:
MAX_LEN (int): Maximum length of the data buffer
READ_FORMAT (str): Format for reading data
pHData (NamedTuple): NamedTuple for pH data
## Classes:
`SI600`: Sentron pH meter class
<i>Documentation ... | kylejeanlewis/control-lab-ly | controllably/Measure/Chemical/Sentron/sentron.py | .py | fdb23e5bbee67be8 | 7.42 | 6 |
# -*- coding: utf-8 -*-
from __future__ import annotations
from collections import deque
from datetime import datetime
from pathlib import Path
import threading
import time
from types import SimpleNamespace
from typing import NamedTuple, Any, Iterable
# Third party imports
import pandas as pd
from pymeasure.instrument... | kylejeanlewis/control-lab-ly | controllably/Measure/Electrical/Keithley/keithley.py | .py | 30ccb28f33317631 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module provides a class for the actuated sensor.
Attributes:
MAX_SPEED (float): Maximum speed
READ_FORMAT (str): Format for reading data
MoveForceData (NamedTuple): NamedTuple for move force data
## Classes:
`ActuatedSensor`: Actuated sensor class
`ForceDispla... | kylejeanlewis/control-lab-ly | controllably/Measure/Mechanical/actuated_sensor.py | .py | 668a5e122b498ec4 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module provides a class for the load cell.
Attributes:
READ_FORMAT (str): Format for reading data
ValueData (NamedTuple): NamedTuple for value data
## Classes:
`LoadCell`: Load cell class
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard library import... | kylejeanlewis/control-lab-ly | controllably/Measure/Mechanical/load_cell.py | .py | 1882c67a6e752832 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module provides a class for the balance.
Attributes:
G (float): Acceleration due to gravity
## Classes:
`Balance`: Balance class
<i>Documentation last updated: 2025-02-22</i>
"""
# Standard library imports
from __future__ import annotations
from datetime import date... | kylejeanlewis/control-lab-ly | controllably/Measure/Physical/balance.py | .py | ac40f605173c0b34 | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""
This module contains the base classes for making measurements with a device.
Attributes:
MAX_LEN (int): maximum length of data buffer
## Classes:
`Measurer`: Base class for maker tools
`Program`: Base Program template
`ProgramDetails`: ProgramDetails dataclass represen... | kylejeanlewis/control-lab-ly | controllably/Measure/measure.py | .py | f402bec139c3fac3 | 7.42 | 6 |
import unicodedata
import re
from datetime import date, datetime, timedelta, timezone
month_names = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]
### Date/Time Utils ##
# Get current datetime
def now():
return datetime.now()
# ret... | IceKirby/NaTrave | futebot/BotUtils.py | .py | 8d7b9dca588cb17e | 7.6 | 15 |
# Expose core classes
from linref.events.base import EventsData
from linref.ext.lrs import LRS
from linref.ext.base import LRS_Accessor
# Expose additional features
from linref.ext.base import integrate
from linref.ext.spatial import generate_intersection_pairs, generate_intersection_nodes
from linref.utility.directio... | tariqshihadah/linref | linref/__init__.py | .py | 5497d155b5c953e3 | 7.54 | 11 |
"""
Deprecation utilities for linref.
Provides a decorator for managing API deprecations, aligned with
conventions from pandas, scikit-learn, and geopandas.
Usage
-----
Deprecating a function or method::
@deprecated(since="1.0.0", alternative="df.lr.relate()")
def old_function():
...
"""
import warn... | tariqshihadah/linref | linref/_deprecation.py | .py | a16e2648dfc3049e | 7.54 | 11 |
"""
Dataset loaders for linref toy datasets.
Provides easy access to sample datasets for learning and testing
linear referencing operations.
"""
import pandas as pd
from pathlib import Path
from typing import Union
import geopandas as gpd
def _get_data_path(filename: str) -> Path:
"""Get the absolute path to a ... | tariqshihadah/linref | linref/datasets/_loaders.py | .py | d076126b2a0aab82 | 7.54 | 11 |
class LinrefError(Exception):
"""Base class for exceptions in Linref."""
class LRSConfigurationError(LinrefError):
"""Exception raised for errors in the LRS configuration."""
class LRSCompatibilityError(LinrefError):
"""Exception raised for LRS compatibility issues between DataFrames."""
class GeometryTo... | tariqshihadah/linref | linref/errors.py | .py | dc0e39e84f44fe58 | 7.54 | 11 |
import numpy as np
from linref.events import common, base, utility
def duplicated(events, subset=None, keep='first'):
"""
Return a boolean mask of duplicated events in terms of all or a selection of
event anchors.
Parameters
----------
events : EventsData
The events object to analyze.... | tariqshihadah/linref | linref/events/analyze.py | .py | aeeb604f4263e304 | 7.54 | 11 |
import numpy as np
from linref.events import common, base
def _method_require(**requirements):
"""
Callable decorator to require that a class meets certain attribute or
property requirements.
"""
def decorator(func):
def wrapper(obj, *args, **kwargs):
for key, value in requirem... | tariqshihadah/linref | linref/events/utility.py | .py | 029460976021ad1f | 7.54 | 11 |
from __future__ import annotations
import copy
import pandas as pd
from linref.utility.utility import label_list_or_none, label_or_none
from linref.events.common import closed_all, default_closed
from linref.errors import LRSConfigurationError
class LRS(object):
def __init__(
self,
key_col: str |... | tariqshihadah/linref | linref/ext/lrs.py | .py | 098e4c9bd20ffc99 | 7.54 | 11 |
from __future__ import annotations
import warnings
import numpy as np
import pandas as pd
import geopandas as gpd
from linref.errors import GeometrySyncWarning, GeometrySyncError
def _method_deprecates_geometry(func) -> callable:
"""
Decorator for LRS_Accessor methods that may de-synchronize the geometry
... | tariqshihadah/linref | linref/ext/validation.py | .py | 0bbd2f5c56ec2b43 | 7.54 | 11 |
from __future__ import annotations
import numpy as np
from collections import deque
from shapely.errors import GeometryTypeError
from linref.errors import GeometryTopologyError
from linref.geometry.linestring_m import LineStringM
def line_merge_m(
lines: list[LineStringM],
allow_multiple: bool = False,
al... | tariqshihadah/linref | linref/geometry/merge.py | .py | 528f27177dba156f | 7.54 | 11 |
from __future__ import annotations
import numpy as np
import shapely
def get_chord_lengths(ls, normalized=False):
"""
Return an array of the chord lengths for each segment in the LineString.
Parameters
----------
ls : LineString
The LineString to compute chord lengths for.
normalized ... | tariqshihadah/linref | linref/geometry/utilities.py | .py | cad1e0193f155be7 | 7.54 | 11 |
from __future__ import annotations
from linref.ext.lrs import LRS
_VALID_GEOMETRY_SYNC = ['none', 'warn', 'error', 'drop']
class _Options:
"""
Package-level options for linref.
Attributes
----------
default_lrs : LRS
The default LRS applied to new DataFrames when no LRS has been set.
... | tariqshihadah/linref | linref/options.py | .py | ab6421018596b735 | 7.54 | 11 |
"""
Unit tests for linref.events.base module.
Tests cover:
- EventsData sorting (sort, argsort, sort_standard)
- EventsData analysis (find_same, find_inside)
"""
import unittest
import numpy as np
from linref.events.base import EventsData
class TestSorting(unittest.TestCase):
"""Tests for EventsData sorting met... | tariqshihadah/linref | linref/tests/test_events_base.py | .py | 98fecd7f7db3d020 | 8.04 | 11 |
"""
Unit tests for linref.events.profile module.
Tests cover profile classes, the resolve_profile function, and integration
with the overlay function.
"""
import unittest
import numpy as np
from linref.events.base import EventsData
from linref.events.profile import (
EventProfile,
UniformProfile,
Triangul... | tariqshihadah/linref | linref/tests/test_events_profile.py | .py | 927191dbbccfc2b2 | 8.04 | 11 |
import unittest
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString, Point
import linref
from linref.ext.spatial import generate_intersection_pairs, generate_intersection_nodes
class TestGenerateIntersectionPairs(unittest.TestCase):
"""Test the standalone generat... | tariqshihadah/linref | linref/tests/test_ext_spatial.py | .py | f743ff8a676dce33 | 7.04 | 11 |
"""
Unit tests for linref.geometry module.
Tests cover:
- LineStringM class initialization and properties
- substring_m_coords function including edge cases
- Floating point precision handling
- Adjacent substring boundary consistency
"""
import unittest
import numpy as np
from shapely.geometry import LineString, Poi... | tariqshihadah/linref | linref/tests/test_geometry.py | .py | 859843f91288fc98 | 7.04 | 11 |
from __future__ import annotations
import math
import numpy as np
import shapely
from shapely.geometry import LineString, MultiLineString
def extract_direction(line: LineString | MultiLineString, labels: list[str] = ['E', 'N', 'W', 'S']) -> str:
"""
Approximate the cardinal direction of the line, based on the ... | tariqshihadah/linref | linref/utility/direction.py | .py | 29045027d652e364 | 7.54 | 11 |
import django_filters
from django.db.models import Value, CharField, Q
from django.db.models.functions import Concat
from apps.core.models import Author
from apps.api.filters.base import BaseSecuredFilter
class AuthorFilter(BaseSecuredFilter):
"""
Author filtering system for finding and browsing content crea... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/filters/authors.py | .py | 9525cc69b300a6c5 | 7.52 | 10 |
import django_filters
from django.core.cache import cache
from django.db.models import Q
from typing import Optional, List
from apps.core.models import Catalog, UserCatalog
class CachedSecuredFilterMixin:
"""
Mixin that provides cached access control for filters.
This mixin caches user permissions and a... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/filters/base.py | .py | 07ea12e0f7538740 | 7.52 | 10 |
import django_filters
from django.db.models import Q
from apps.core.models import Catalog
from apps.api.filters.base import BaseSecuredFilter
class CatalogFilter(BaseSecuredFilter):
"""
Catalog filtering system for browsing and discovering content collections.
Provides filtering capabilities for catalog... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/filters/catalogs.py | .py | 5112e7f1d4cad9df | 7.52 | 10 |
from typing import List
from urllib.parse import urlencode
import django_filters
from django.core.exceptions import ValidationError
from django.db.models import Q, Value, CharField, Case, When, IntegerField
from django.db.models.functions import Concat, Lower
from django.utils.translation import gettext as _
from part... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/filters/entries.py | .py | cf0ba6dd992d6b68 | 7.52 | 10 |
import uuid
import django_filters
from django.core.exceptions import ValidationError
from django.forms import UUIDField
from apps.core.models import Feed
class FeedFilter(django_filters.FilterSet):
"""
Feed filtering system for organizing and browsing content collections.
Provides filtering capabilitie... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/filters/feeds.py | .py | 132be9127182e9d1 | 7.52 | 10 |
from copy import copy
from typing import Any
from pydantic import BaseModel
class Serializer(BaseModel):
class Config:
from_attributes = True
@staticmethod
def model_title_generator(model):
return model.__qualname__
@staticmethod
def json_schema_extra(schema:... | EvilFlowersCatalog/EvilFlowersCatalog | apps/api/serializers/__init__.py | .py | acd7b36d7bb86229 | 7.52 | 10 |
# Copyright 2026 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | dwave-examples/job-shop-scheduling | demo_callbacks.py | .py | cecb5d9f05a8e699 | 7.6 | 15 |
# Copyright 2024 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | dwave-examples/job-shop-scheduling | src/generate_charts.py | .py | f2c7e2ce0febcb8d | 7.6 | 15 |
# Copyright 2026 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | dwave-examples/job-shop-scheduling | src/utils/greedy.py | .py | e5caa96b7fdf44de | 7.6 | 15 |
# Copyright 2022 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | dwave-examples/job-shop-scheduling | src/utils/mip_solver.py | .py | ce339d0c7175208f | 7.6 | 15 |
# Copyright 2026 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | dwave-examples/job-shop-scheduling | src/utils/plot_schedule.py | .py | b2ee00d3c47b067c | 7.6 | 15 |
# Copyright 2026 D-Wave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | dwave-examples/job-shop-scheduling | tests/test_jss_scheduler.py | .py | eb169ba8a694678d | 8.1 | 15 |
import bpy
def hdr_swap(name, hdr):
"""
Try to replace the hdr in current world setup. If this fails, create a new world.
:param name: Name of the resulting world (renamse the current one if swap is successfull)
:param hdr: Image type
:return: None
"""
w = bpy.context.scene.world
if w:... | AxisCommunications/blenderset-addon | blenderset/utils/hdr.py | .py | 8aa3f8528d26bf0a | 7.52 | 10 |
import logging
import os
import colorama
HOST_FORMAT = "%(asctime)s %(levelname)s %(process)d %(name)s %(message)s"
class HighlightFormatter(logging.Formatter):
def format(self, record: logging.LogRecord):
if record.levelno >= logging.ERROR:
color = colorama.Fore.RED + colorama.Style.BRIGHT
... | AxisCommunications/blenderset-addon | blenderset/utils/log.py | .py | d48a69df0f20e53d | 7.52 | 10 |
from __future__ import annotations
import dataclasses
import datetime
import itertools
import json
import os
import pathlib
import shutil
from pathlib import Path
from typing import Generic, TypeVar
import math
import more_itertools
import bpy
from blenderset.render import PreviewRenderer, Renderer
from blenderset.s... | AxisCommunications/blenderset-addon | render_overlapping_boundingboxes_only.py | .py | d65bb1de69c7f3b5 | 7.52 | 10 |
import json
from typing import Any
from typing import Dict
def hash_generator(obj: Any) -> int:
"""
Generate a hash from any object by converting it to JSON string
Args:
obj: Any object that can be serialized to JSON
Returns:
A 32-bit integer hash
"""
obj_string = json.dumps... | tago-io/sdk-python | src/tagoio_sdk/common/Hash_Generator.py | .py | 65fc75d5d99f992b | 7.48 | 8 |
import asyncio
import inspect
import json
import os
import sys
from typing import Any
from typing import List
from typing import Optional
from tagoio_sdk.common.JSON_Parse_Safe import JSONParseSafe
from tagoio_sdk.common.tagoio_module import TagoIOModule
from tagoio_sdk.infrastructure.api_sse import openSSEListening
... | tago-io/sdk-python | src/tagoio_sdk/modules/Analysis/Analysis.py | .py | a435ed7bbf40a171 | 7.48 | 8 |
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import TypedDict
from typing import Union
from tagoio_sdk.regions import Regions
from tagoio_sdk.regions import RegionsObj
AnalysisFunction = Callable[[Any, Any], Any]
class An... | tago-io/sdk-python | src/tagoio_sdk/modules/Analysis/Analysis_Type.py | .py | 6962f99edcdefe1c | 7.48 | 8 |
from tagoio_sdk.common.tagoio_module import GenericModuleParams
from .Access import Access
from .Account import Account
from .Actions import Actions
from .Analyses import Analyses
from .Billing import Billing
from .Buckets import Buckets
from .Dashboards import Dashboards
from .Devices import Devices
from .Dictionarie... | tago-io/sdk-python | src/tagoio_sdk/modules/Resources/AccountDeprecated.py | .py | 3659d28872ec5317 | 7.48 | 8 |
from datetime import datetime
from typing import Any
from typing import Dict
from typing import List
from typing import Literal
from typing import Optional
from typing import TypedDict
from typing import Union
from tagoio_sdk.common.Common_Type import Base64
from tagoio_sdk.common.Common_Type import ExpireTimeOption
f... | tago-io/sdk-python | src/tagoio_sdk/modules/Resources/Analysis_Types.py | .py | 34b49cfd54d87fdc | 7.48 | 8 |
from typing import Union
from tagoio_sdk.common.Common_Type import GenericID
from tagoio_sdk.common.tagoio_module import TagoIOModule
from tagoio_sdk.modules.Utils.dateParser import dateParser
class Buckets(TagoIOModule):
def info(self, bucketID: GenericID) -> str:
"""
@deprecated Moved to Resour... | tago-io/sdk-python | src/tagoio_sdk/modules/Resources/Buckets.py | .py | 782e3aa2c7260cfe | 7.48 | 8 |
"""Shared test fixtures for the integration tests."""
import os
from typing import Generator
import pytest
import ansys.modelcenter.workflow.grpc_modelcenter as grpcmc
@pytest.fixture(scope="session", name="engine")
def create_engine() -> Generator[grpcmc.Engine, None, None]:
"""Setup called before each test f... | ansys/pymodelcenter | integration/conftest.py | .py | e91c11be075d7a8e | 7.92 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.