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
# gp.py: Very primitive gaussian process regression module. Returns an object # # - Prediction: K(x,x').inv(Kmtx).y. We store and precompute inv(Kmtx).y import numpy as np from sklearn import gaussian_process def squared_exponential_kernel(dx,h,sigma0,sigmab): ret = np.power(sigma0,2) * np.exp(- np.power(...
oshaughn/research-projects-RIT
MonteCarloMarginalizeCode/Code/RIFT/interpolators/gp.py
.py
c4c42a2a47f0c3f1
7.64
18
#!usr/env/bin python ''' GPR_Fit.py python 2.7.13 Vera Delfavero Date updated: 02/02/2019 The function of this script is to provide the function, "fit_gp" to the PE code (utils_ConstructIntrinsicPosterior_GenericCoordinates.py) That function will fit training data, using a sparse gaussian proces, and return a functio...
oshaughn/research-projects-RIT
MonteCarloMarginalizeCode/Code/RIFT/interpolators/internal_GP.py
.py
bdab6b7abe5633eb
7.64
18
import numpy as np import scipy.integrate xpy_default=np has_cupy = False try: import cupy # can proceed even if cupy doesn't actually work junk_to_check_installed = cupy.array(5) xpy_default=cupy has_cupy=True except: has_cupy=False # just to be sure # try: # import numba # from numba ...
oshaughn/research-projects-RIT
MonteCarloMarginalizeCode/Code/RIFT/likelihood/priors_utils.py
.py
1e57a7b6fc6114cf
7.64
18
# Dan Wysocki import numpy as np import numpy def histogram(samples, n_bins, xpy=numpy,weights=None): """ samples : data between [0,1] n_bins: number of bins of output weights: weights in histogram """ n_samples = samples.size # sometimes due to input conditioning issues (floats!) the...
oshaughn/research-projects-RIT
MonteCarloMarginalizeCode/Code/RIFT/likelihood/vectorized_general_tools.py
.py
b62bcbe3b12617cc
7.64
18
import numpy try: import cupy xpy_default=cupy junk_to_check_installed = cupy.array(5) # this will fail if GPU not installed correctly except: xpy_default=numpy def TimeDelayFromEarthCenter( detector_earthfixed_xyz_metres, source_right_ascension_radians, source_declination_ra...
oshaughn/research-projects-RIT
MonteCarloMarginalizeCode/Code/RIFT/likelihood/vectorized_lal_tools.py
.py
8f5f6052bc7db796
7.64
18
#!/usr/bin/env python3 """Discover, build, and run host unit tests (*_test.c). Compiler resolution (first match wins): 1. HOST_CC env (space-separated), e.g. HOST_CC=gcc 2. python-zig on PATH — uv tool install ziglang 3. zig on PATH — system Zig (uses: zig cc) 4. uvx --from ziglang python-zig 5. p...
DaelonSuzuka/Easy-XC8
scripts/host_test.py
.py
bd81ed1e43a91a2b
7.92
6
"""Programmer family resolution for upload/program. project.yaml names the *family* (Pickit4, Pickit5, …). Host OS selects the platform overlay from upload.json (windows | posix). Legacy aliases (Pickit4-linux, ICD-U80-win, …) still resolve for old yamls. """ from __future__ import annotations import json import os...
DaelonSuzuka/Easy-XC8
scripts/programmers.py
.py
07e8d4b3c0d3a39d
7.42
6
"""Config flow for Notify MQTT.""" from __future__ import annotations from typing import Any import voluptuous as vol from homeassistant.components.mqtt import valid_publish_topic from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult, OptionsFlow from homeassistant.core import callback f...
arkane-systems/notify_mqtt
custom_components/notify_mqtt/config_flow.py
.py
53d2f9345699494e
7.45
7
"""Tests for the notify.py platform: _build_payload and both entity/service paths.""" from __future__ import annotations import json from unittest.mock import AsyncMock, patch import pytest from custom_components.notify_mqtt.const import CONF_NAME, CONF_TOPIC, DOMAIN from custom_components.notify_mqtt.notify import ...
arkane-systems/notify_mqtt
tests/test_notify.py
.py
cf4e6ae2c0edc4f8
7.95
7
"""Authentication helpers for the Emmio API. Two independent pieces: - Password hashing with bcrypt. Passwords are never stored; only a one-way hash is kept, and login re-hashes the candidate and compares. - Stateless access tokens (JWT). After a correct login the server issues a signed token carrying the user lo...
enzet/Emmio
emmio/api/auth.py
.py
5f0c37c6adcb29da
7.54
11
"""In-process rate limiting for abuse-prone endpoints. Deliberately dependency-free (no `slowapi`/Redis): a fixed-window counter keyed by client IP, held in a plain dict behind a lock. This is enough for a single-process deployment -- the `Dockerfile` runs one `uvicorn` process, no `--workers` -- but does *not* share ...
enzet/Emmio
emmio/api/rate_limit.py
.py
b8e6fab368e7bcfe
7.54
11
"""Render Emmio UI elements as HTML for the web API. A third rendering target for the shared `emmio.ui` element tree, alongside the terminal and rich-console interfaces. All text content is HTML-escaped and only a fixed set of tags is emitted, so the result is safe to insert into the page. """ from html import escape...
enzet/Emmio
emmio/api/render.py
.py
8df6ae8fc2ea311b
7.54
11
"""Server-side sessions: working memory kept between API requests. A session object is only the selection policy's (or scheduler's) working memory — answers themselves are persisted per request as ground truth. Losing a session (restart, eviction, expiry) therefore never loses data: the working memory is rebuilt from ...
enzet/Emmio
emmio/api/sessions.py
.py
b0f71de6f74ed873
7.54
11
"""Core functionality for listening.""" import hashlib import json import logging import re from abc import ABC, abstractmethod from collections import defaultdict from dataclasses import dataclass from pathlib import Path from typing import Self, override try: import mpv except (OSError, ImportError): mpv = ...
enzet/Emmio
emmio/audio/core.py
.py
0edbe9633b74c3d1
7.54
11
"""Data for audio files.""" import logging from dataclasses import dataclass from pathlib import Path from typing import Any, Self from emmio.audio.config import AudioConfig, AudioUsageConfig from emmio.audio.core import ( AudioCollection, AudioProvider, DirectoryAudioProvider, WikimediaCommonsAudioPr...
enzet/Emmio
emmio/audio/data.py
.py
bb1be585fdac99ab
7.54
11
"""Core functionality.""" import json import logging from abc import ABC, abstractmethod from datetime import datetime from pathlib import Path from typing import Any, Self from pydantic import BaseModel class Record(BaseModel, ABC): """An abstraction for a record of actions.""" time: datetime """Time ...
enzet/Emmio
emmio/core.py
.py
d87e6b2384f1e278
7.54
11
"""Manager for all Emmio data artifacts. This class manages Emmio data directory which is by default located in `~/.emmio`. It expects to find directories - `lists`, - `sentences`, - `dictionaries`, - `audio`, - `texts`, with artifacts and directory `users` with user data. """ import logging from collection...
enzet/Emmio
emmio/data.py
.py
a828ed9cdb1b9cd8
7.54
11
"""SQLite 3 utility.""" import sqlite3 import threading from pathlib import Path from sqlite3.dbapi2 import Connection __author__ = "Sergey Vartanov" __email__ = "me@enzet.ru" class Database: """Pretty simple wrapper for SQLite database. The database object is shared across threads (sync FastAPI endpoints ...
enzet/Emmio
emmio/database.py
.py
caaf80b9d9ca392e
7.54
11
"""Configuration of a dictionary.""" from typing import Literal from pydantic.main import BaseModel from emmio.language import LanguageConfig class DictionaryUsageConfig(BaseModel): """Configuration of a dictionary.""" id: str """Identifier of the dictionary.""" from_language: LanguageConfig | No...
enzet/Emmio
emmio/dictionary/config.py
.py
2cf404fb457bbfd1
7.54
11
"""Data for dictionaries.""" import logging import threading from dataclasses import dataclass, field from pathlib import Path from typing import Any, Self from emmio.catalog import KAIKKI_LANGUAGES from emmio.core import ArtifactData from emmio.dictionary.config import DictionaryConfig, DictionaryUsageConfig from em...
enzet/Emmio
emmio/dictionary/data.py
.py
a157e257baffcf86
7.54
11
"""Gate for English Wiktionary service. See https://en.wiktionary.org. """ import json import logging import shutil from pathlib import Path from typing import Any, override import requests from tqdm import tqdm from emmio.dictionary.core import ( Definition, DefinitionValue, Dictionary, DictionaryI...
enzet/Emmio
emmio/dictionary/en_wiktionary.py
.py
beed77aa478c2d54
7.54
11
"""An interface to Google Translate dictionary. See https://translate.google.com/ """ from pathlib import Path from typing import override import httpx from googletrans import Translator from emmio.dictionary.core import Dictionary, DictionaryItem from emmio.language import Language # Cap how long a single live tr...
enzet/Emmio
emmio/dictionary/google_translate.py
.py
4d26e02f4927b1e1
7.54
11
"""Self-reported language knowledge: curated assessment kinds and values. A user may log a proficiency estimate for a language at any time — not Emmio's own computed lexicon rate, but a self-report they enter by hand, e.g. "French, B2, DELF/DALF, 2022-06-01". Each estimate names a *kind* (native speaker, self-assessed...
enzet/Emmio
emmio/language_knowledge.py
.py
39468125a3a11b1a
7.54
11
"""Learning configuration.""" from enum import Enum from pydantic import BaseModel from emmio.audio.config import AudioUsageConfig from emmio.dictionary.config import DictionaryUsageConfig from emmio.language import LanguageConfig from emmio.lexicon.config import LexiconUsageConfig from emmio.lists.config import Lis...
enzet/Emmio
emmio/learn/config.py
.py
094caffb52a63572
7.54
11
"""Data of learning processes.""" from collections.abc import Iterator from dataclasses import dataclass, field from datetime import datetime from pathlib import Path from typing import Any, Self from emmio.language import Language from emmio.learn.config import LearningConfig from emmio.learn.core import Learning, R...
enzet/Emmio
emmio/learn/data.py
.py
60a4d9259a731b69
7.54
11
# mypy: ignore-errors """Learning visualizer.""" from collections import defaultdict from dataclasses import dataclass from datetime import datetime, timedelta import numpy as np from matplotlib import dates as mdates from matplotlib import pyplot as plt from matplotlib import transforms as mtransforms from emmio.le...
enzet/Emmio
emmio/learn/visualizer.py
.py
08fdc2b31cac26d7
7.54
11
"""Configuration for the lexicon.""" from enum import StrEnum from pydantic.main import BaseModel from emmio.dictionary.config import DictionaryUsageConfig from emmio.language import LanguageConfig from emmio.lists.config import ListUsageConfig from emmio.sentence.config import SentencesUsageConfig LexiconConfigVal...
enzet/Emmio
emmio/lexicon/config.py
.py
19d76f9dbbfa014b
7.54
11
"""Lexicon data.""" import logging import sys from collections import defaultdict from dataclasses import dataclass, field from pathlib import Path from typing import Any, Self from pydantic import ValidationError from emmio.language import Language from emmio.lexicon.config import LexiconConfig from emmio.lexicon.c...
enzet/Emmio
emmio/lexicon/data.py
.py
49f8cb48f20ea21b
7.54
11
"""Fixed goal parameters for lexicon precision tracking. A lexicon's rate estimate is considered *trustworthy* once its standard deviation, computed with the estimator matching the lexicon's selection strategy over only the trailing `WINDOW_DAYS` of answers, is at or under `SD_THRESHOLD`. Once trustworthy, rechecking ...
enzet/Emmio
emmio/lexicon/goal.py
.py
dc8224e1263716b9
7.54
11
"""Windowed rate history: the vocabulary rate as it changes through time. Every selection strategy gets its history the same way: a sliding window over the chronological answer log, kept as small as the strategy-matched estimator allows while its standard deviation stays under a threshold. A small window follows the l...
enzet/Emmio
emmio/lexicon/history.py
.py
fd367f638d677ed7
7.54
11
"""Shared Matplotlib styling for rate estimate trajectory plots. The visualizer (`emmio.lexicon.visualize`) draws the same kind of picture — a rate estimate trajectory over queries — from the CSV files of both the simulation (`emmio.lexicon.simulation`) and the real-log replay (`emmio.lexicon.replay`); the chart chrom...
enzet/Emmio
emmio/lexicon/plotting.py
.py
a9d8b3fe46854627
7.54
11
"""Simulation of the four lexicon checking methods on a fake language. Build a synthetic Zipfian frequency list for a fake language, draw a random knowledge profile (a 0/1 label per word) calibrated so that the frequency-weighted share of unknown words matches a chosen rate `r`, then drive every checking method — FWR ...
enzet/Emmio
emmio/lexicon/simulation.py
.py
98d902779ead5dbb
7.54
11
r"""Shared TikZ (pgfplots) rendering for rate estimate trajectory plots. The visualizer (`emmio.lexicon.visualize`) can render the simulation and replay trajectories not only as images but also as TikZ code, ready to be embedded into a LaTeX document (e.g. with `\input`). The picture mirrors the Matplotlib style of `e...
enzet/Emmio
emmio/lexicon/tikz.py
.py
de79ea7a911e8e6d
7.54
11
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function __metaclass__ = type try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() from ansible.errors import AnsibleError from ansible.plugins...
metal-stack/ansible-common
action_plugins/print_message.py
.py
7f77fdf5f43a7360
7.42
6
"""Python client library for the InterGas InComfort system (via Lan2RF gateway). Each Gateway can have up to 8 Heaters (boilers) and each Heater can have 0-2 active Room thermostats. """ from __future__ import annotations import json import logging from enum import IntEnum from typing import TYPE_CHECKING, Any impo...
jbouwh/incomfort-client
src/incomfortclient/__init__.py
.py
d75e71059a0c4fcf
7.5
9
"""Fixtures for incomfort backend library.""" from collections.abc import Awaitable, Callable from typing import Any from aiohttp import web from aiohttp.test_utils import TestServer import pytest @pytest.fixture(name="heater_list_exc") def mock_heater_list_exception() -> Exception | None: """Mock a heater lis...
jbouwh/incomfort-client
tests/conftest.py
.py
48f09fa0dce8b3c5
8
9
import os import sys import click from dotenv import load_dotenv from flask_migrate import Migrate, upgrade from app_core import create_app, db from app_core.models import User, Role, Gender, Permission, Follow, Comment, Post dot_env_path = os.path.join(os.path.dirname(__file__), '.env') if os.path.exists(dot_env_pa...
realJustinLee/LiCMS
app.py
.py
489cb0710a759e51
7.63
17
import unittest import onetimepass from app_core import create_app, db from app_core.models import User, Role, Gender class FlaskClientTestCase(unittest.TestCase): def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() ...
realJustinLee/LiCMS
tests/test_client.py
.py
0c6fae9bed683870
7.13
17
import threading import time import unittest import onetimepass from selenium import webdriver from selenium.webdriver.chrome.service import Service as ChromeService from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from webdriver_manager.chrome import ChromeDriverMa...
realJustinLee/LiCMS
tests/test_selenium.py
.py
04889a7a34b4d0b7
7.13
17
"""命令行工具:从基金 xlsx 文件生成历史价格折线图。 用法示例: python k-wall.py -f funds.xlsx python k-wall.py -f funds.xlsx -d 180 -r nearest python k-wall.py -f funds.xlsx --headless -o result.png """ import argparse import numpy as np import matplotlib.pyplot as plt import openpyxl from math import ceil import time from em1234...
CH3COOOH/Eastmoney1234567
k-wall.py
.py
f3e5969786459a7a
7.42
6
"""A class for interacting with Aussie Broadband APIs""" # import json import sys from time import time from typing import Any, cast import requests import requests.sessions from pydantic import SecretStr from requests.models import Response from .baseclass import BaseClass from .const import BASEURL, PHONE_TYPES, d...
yaleman/pyaussiebb
aussiebb/__init__.py
.py
544728e30f87b839
7.57
13
"""base class def""" import logging from http.cookies import Morsel, SimpleCookie from time import time from typing import Any from pydantic import SecretStr from requests.cookies import RequestsCookieJar from .const import ( API_ENDPOINTS, BASEURL, FETCH_TYPES, HARDWARE_TYPES, NBN_TYPES, PHO...
yaleman/pyaussiebb
aussiebb/baseclass.py
.py
7c8aa5f4963819de
7.57
13
"""types""" from datetime import datetime from typing import Any, TypedDict from pydantic import BaseModel, ConfigDict, Field, SecretStr, field_validator class AccountTransaction(TypedDict): """Transaction data typing, returns from account_transactions""" id: int type: str time: str description...
yaleman/pyaussiebb
aussiebb/types.py
.py
6ad8d9441c72583a
7.57
13
#!/usr/bin/env python """pulls and lists the VOIP services on your account""" # pylint: disable=wrong-import-position import asyncio import json import os import sys from pathlib import Path import aiohttp script_path = Path(__file__) sys.path.append(script_path.parent.parent.as_posix()) # pylint: disable=import...
yaleman/pyaussiebb
examples/get_service_info.py
.py
80969cbefdffbcd1
7.57
13
#!/usr/bin/env python """pulls and lists the IPv6 addresess for your services""" import asyncio import json import os import sys from ipaddress import IPv4Network, IPv6Network, ip_network from pathlib import Path script_path = Path(__file__) sys.path.append(script_path.parent.parent.as_posix()) # pylint: disable=i...
yaleman/pyaussiebb
examples/grabipv6.py
.py
46f0cce3a9cb1e28
7.57
13
#!/usr/bin/env python3 """updates terraform.tfvars based on the current ipv6 subnet assigned to your network looks for a variable called "base_ipv6_network" and updates it. """ import os import re import sys from ipaddress import IPv6Network, ip_network from pathlib import Path filepath = Path(__file__) sys.path.ap...
yaleman/pyaussiebb
examples/update_terraform_ipv6.py
.py
48aa3341c3afa866
7.57
13
""" Using this You really need a file called "aussiebb.json" in either the local dir or ~/.config/. It needs at least one user in the "users" field. eg: { "users" : [ { "username" : "mickeymouse.123", "password" : "hunter2" } ] } """ import json import pytest import aussiebb.const from aussiebb im...
yaleman/pyaussiebb
tests/test_aussiebb.py
.py
8bddbbadf6b5c621
7.07
13
"""test some things""" import json import pytest import aussiebb.const from aussiebb.asyncio import AussieBB # from aussiebb.exceptions import InvalidTestForService from aussiebb.types import ConfigUser from .test_utils import configloader, users # noqa: F401 # All test coroutines will be treated as marked. pyte...
yaleman/pyaussiebb
tests/test_aussiebb_asyncio.py
.py
b3fa553cc0b7ebcf
8.07
13
""" Using this You really need a file called "aussiebb.json" in either the local dir or ~/.config/. It needs at least one user in the "users" field. eg: { "users" : [ { "username" : "mickeymouse.123", "password" : "hunter2" } ] } """ import json import pytest from aussiebb import AussieBB from .t...
yaleman/pyaussiebb
tests/test_aussiebb_orders.py
.py
864da042d788fdc8
7.07
13
""" Using this You really need a file called "aussiebb.json" in either the local dir or ~/.config/. It needs at least one user in the "users" field. eg: { "users" : [ { "username" : "mickeymouse.123", "password" : "hunter2" } ] } """ import json import pytest from aussiebb import AussieBB from aus...
yaleman/pyaussiebb
tests/test_aussiebb_outages.py
.py
89ae923d604d8aa5
7.07
13
"""tests some fetch-service-related things""" import json from aussiebb import types def test_fetch_service_parser() -> None: """tests parsing an example service""" fetch_service = json.loads( """ { "service_id": 332780, "type": "FETCHTV", "name": "Fetch Tv", "plan": "F...
yaleman/pyaussiebb
tests/test_fetch.py
.py
3a11208a8769906e
8.07
13
""" pyaussiebb tests """ import pytest from pydantic import SecretStr from aussiebb.baseclass import BaseClass from aussiebb.exceptions import UnrecognisedServiceType def test_validate_service_type() -> None: """testing the validate_service_type function""" test = BaseClass( username="foo", ...
yaleman/pyaussiebb
tests/test_field_validation.py
.py
67d61b12c75b32cd
7.07
13
"""test utils""" import json import os from pathlib import Path import pytest from aussiebb import AussieBB from aussiebb.types import AussieBBConfigFile CONFIG_FILES = [os.path.expanduser("~/.config/aussiebb.json"), "aussiebb.json"] def configloader() -> AussieBBConfigFile: """loads config""" for filenam...
yaleman/pyaussiebb
tests/test_utils.py
.py
bcb84f47a9ba18b3
8.07
13
import typing import webob import webtest from starlette.testclient import TestClient from starlette.types import ASGIApp WSGIApp = typing.Callable[ [typing.MutableMapping, typing.Callable], list[typing.ByteString] ] def AsgiToWsgi(asgi_app: ASGIApp) -> WSGIApp: def handle(environ, start_response): ...
sloria/webtest-asgi
webtest_asgi.py
.py
1cd043bdb5d941e4
7.95
7
from dataclasses import dataclass from typing import Optional @dataclass(frozen=True) class AgeScope: """A subset of ages used for prevalence/incidence pooling and calibration. lo/hi are inclusive bounds; None means unbounded on that side. AgeScope() -> all ages AgeScope(65, None...
jburke5/microsim
microsim/common/age_scope.py
.py
9c5772cdd8f7321b
7.42
6
from microsim.outcomes.ascvd_outcome_model import ASCVDOutcomeModel from microsim.regression_models.regression_model import RegressionModel from microsim.common.data_loader import load_model_spec from microsim.outcomes.outcome import Outcome, OutcomeType from microsim.outcomes.outcome_prevalence_base import OutcomePrev...
jburke5/microsim
microsim/outcomes/cv_model.py
.py
69c3f6c5a9c1f254
7.42
6
from microsim.outcomes.outcome import Outcome, OutcomeType class DeathModel: """Checks if any outcome produced in the current year was fatal. Does not produce any additional fatalities.""" def __init__(self): pass def generate_next_outcome(self, person): return Outcome(OutcomeT...
jburke5/microsim
microsim/outcomes/death_model.py
.py
f146bc1432356831
7.42
6
from microsim.outcomes.dementia_model import DementiaModel, DementiaPrevalenceModel from microsim.risk_factors.modality import Modality class DementiaModelRepository: def __init__(self, wmhSpecific=True, riskScaling=1.0): #if we want the dementia model to return an average risk for the kaiser population, i...
jburke5/microsim
microsim/outcomes/dementia_model_repository.py
.py
cdeac36e9496e6d9
7.42
6
from microsim.outcomes.outcome import Outcome, OutcomeType from microsim.treatment_strategies.treatment_strategies import TreatmentStrategiesType class MCIModel: """Mild cognitive impairment model.""" def __init__(self, riskScaling=1.0): self._riskScaling = riskScaling def generate_next_outcome(s...
jburke5/microsim
microsim/outcomes/mci_model.py
.py
bec16238cd18f64e
7.42
6
from microsim.outcomes.outcome import OutcomeType, Outcome from microsim.outcomes.outcome_prevalence_base import OutcomePrevalenceBase class MIPartitionModel: """Fatal mi probability from: Wadhera, R. K., Joynt Maddox, K. E., Wang, Y., Shen, C., Bhatt, D. L., & Yeh, R. W. (2018). Association Between 30-Day...
jburke5/microsim
microsim/outcomes/mi_partition_model.py
.py
c8f9c10207b5527c
7.42
6
from microsim.regression_models.logistic_risk_factor_model import LogisticRiskFactorModel from microsim.common.data_loader import load_model_spec from microsim.regression_models.regression_model import RegressionModel from microsim.outcomes.outcome import Outcome, OutcomeType from microsim.risk_factors.modality import ...
jburke5/microsim
microsim/outcomes/non_cv_death_model.py
.py
dc216f12ee698700
7.42
6
from microsim.regression_models.linear_risk_factor_model import LinearRiskFactorModel from microsim.regression_models.regression_model import RegressionModel from microsim.common.data_loader import load_model_spec from microsim.outcomes.outcome import OutcomeType, Outcome from microsim.outcomes.outcome_prevalence_base ...
jburke5/microsim
microsim/outcomes/stroke_partition_model.py
.py
97ebff04bf93f6a9
7.42
6
from microsim.outcomes.sbi_model import SBIModel from microsim.outcomes.wmh_outcome import WMHOutcome from microsim.outcomes.wmh_severity_unknown import WMHSeverityUnknownModel from microsim.outcomes.wmh_severity import WMHSeverityCTModel, WMHSeverityMRModel, WMHSeverityModel, WMHSeverity from microsim.outcomes.outcome...
jburke5/microsim
microsim/outcomes/wmh_model.py
.py
247a8eee39fbb230
7.42
6
"""Jupyter Notebook collection README generator Copyright by the SalishSeaCast Project contributors and The University of British Columbia. 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 https...
SalishSeaCast/SalishSeaNowcast
notebooks/figures/comparison/make_readme.py
.py
b2b0f5fed781d153
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
notebooks/make_readme.py
.py
5abaa9f6f821f8cd
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/analyze.py
.py
f551348d742d1b91
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/comparison/compare_venus_ctd.py
.py
6fd087746ddb1259
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/comparison/salinity_ferry_track.py
.py
6b32d5881034fd83
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/publish/pt_atkinson_tide.py
.py
8bb1b20856a42c73
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/publish/surface_current_tiles.py
.py
100f4bbf368166e4
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/research/baynes_sound_agrif.py
.py
fd6e28f5d7411795
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/research/time_series_plots.py
.py
396a2d3cad558811
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/research/velocity_section_and_surface.py
.py
f4ff9a3d74f6c5c1
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/research_ferries.py
.py
c4e90c79f6c7fbc0
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project Contributors # and The University of British Columbia # 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 # https://www.apache.org/licen...
SalishSeaCast/SalishSeaNowcast
nowcast/figures/surface_current_domain.py
.py
9bae026cb46c115d
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/lib.py
.py
9b52f739d2fea7f0
7.45
7
"""script to generate plots for a simulation Use: python plots.py sim_date mode Eg: python plots.py 2015-03-06 nowcast generates plots for the March 6, 2015 nowcast. sim_date corresponds to the date simulated. plots are stored in a directory mode/run_dat, where run_date is the date the simulation was run. """ import ...
SalishSeaCast/SalishSeaNowcast
nowcast/plots.py
.py
2595928a6e356932
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/archive_tarball.py
.py
2056bdc1b1a369d2
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/collect_NeahBay_ssh.py
.py
d407a3d5f8eca807
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/collect_river_data.py
.py
74820ec45ac95609
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/collect_weather.py
.py
22a6c80629a3be6f
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/crop_gribs.py
.py
dd9761781b495ab9
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/download_live_ocean.py
.py
44e4e6eeb5586066
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/download_results.py
.py
858cfbcdefa0e1e1
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/download_weather.py
.py
a721568918aa16f3
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/download_wwatch3_results.py
.py
c70ebe0ab795f8a2
7.45
7
# Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # 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 # # https://www.apache.o...
SalishSeaCast/SalishSeaNowcast
nowcast/workers/get_onc_ctd.py
.py
898a8d6be8561d2d
7.45
7
""" A barebones set of classes to manage channel width constraints for MOM6 grids. It is effectively a list that can be applied on top of the bathymetry, and is not git-backed. The channels represent a separate concern and can be independently shared, or managed outside the topography versioning system. It is a basical...
NCAR/mom6_forge
mom6_forge/channel_width.py
.py
40e584eccc96bb1e
7.52
10
from mom6_forge.grid import Grid from mom6_forge.topo import Topo import xarray as xr import numpy as np import xesmf as xe from datetime import datetime from pathlib import Path from os.path import isfile from mom6_forge.utils import fill_missing_data, compute_subsampling_factor from mom6_forge.mapping import regrid_w...
NCAR/mom6_forge
mom6_forge/chl.py
.py
8c041937b66fb808
7.52
10
import json import os from abc import ABC, abstractmethod from enum import Enum from mom6_forge.git_utils import get_repo from pathlib import Path from mom6_forge.edit_command import EditCommand class CommandType(Enum): """Enumeration for command types in the history.""" INITIAL = "INITIAL" COMMAND = "CO...
NCAR/mom6_forge
mom6_forge/command_manager.py
.py
f6203b318f41aa5b
7.52
10
import os import git import hashlib from pathlib import Path def get_domain_dir(grid, base_dir="TopoLibrary"): """ Returns a unique directory path for a given grid object. Works for both rectilinear and curvilinear grids. """ # Flatten and convert to bytes (deterministic) data_bytes = grid.tl...
NCAR/mom6_forge
mom6_forge/git_utils.py
.py
e5bcaeed4cff6b4f
7.52
10
"""Auxiliary functions for grid property computations.""" from pathlib import Path import xarray as xr import numpy as np import scipy def longitude_slicer(data, longitude_extent, longitude_coords): """Slice a dataset in longitude, handling periodicity and domain seams. Correctly clips datasets whose longit...
NCAR/mom6_forge
mom6_forge/utils.py
.py
8a64be7ae0940042
7.52
10
import os from datetime import datetime import numpy as np import xarray as xr from typing import Literal class VGrid: """ Vertical grid class. Attributes ---------- dz: np.ndarray Array of vertical grid spacings nk: int Number of vertical levels depth: float Tota...
NCAR/mom6_forge
mom6_forge/vgrid.py
.py
14cb7e7cba668dbd
7.52
10
import pytest from mom6_forge.channel_width import ChannelWidth, ChannelWidthList def test_channel_width_validation(): """Test that ChannelWidth validates component is U_width or V_width""" # Valid cases ch_u = ChannelWidth( component="U_width", lon1=-6.5, lon2=-4.75, lat1=...
NCAR/mom6_forge
tests/test_channel_width.py
.py
57ffc9a9e8e45cc3
8.02
10
from mom6_forge.grid import Grid from mom6_forge.topo import Topo from mom6_forge.chl import interpolate_and_fill_seawifs import pytest import os from utils import on_cisl_machine def test_chl(tmp_path, get_rect_grid): """Test the creation of chl files.""" if not on_cisl_machine(): pytest.skip("This t...
NCAR/mom6_forge
tests/test_chl.py
.py
0649c083844cc8bb
7.02
10
"""Test mask functionality: setting, applying, and depth masking behavior.""" import numpy as np import pytest import xarray as xr from mom6_forge.edit_command import MaskEditCommand, ClearMaskCommand import regionmask from unittest.mock import MagicMock, patch from mom6_forge.topo import Topo def test_generate_mask...
NCAR/mom6_forge
tests/test_masks.py
.py
2dcaaaaa1017254b
8.02
10
"""Initially setup in regional_mom6""" from mom6_forge._supergrid import ( SupergridBase, mom6_angle_calculation_method, modulo_around_point, ) from mom6_forge.grid import Grid import math import pytest import xarray as xr import numpy as np tol_angle = 5e-1 # tolerance for angles (in degrees) from seper...
NCAR/mom6_forge
tests/test_rotation.py
.py
cabc72afb4b546f0
7.02
10
"""Smoke test for SourceBathy loader.""" import numpy as np import pytest import tempfile from pathlib import Path import xarray as xr from mom6_forge._source_bathy import SourceBathy def test_simple_source_bathy_calls(get_rect_topo_without_vc, synthetic_bathy_file): src = SourceBathy( get_rect_topo_with...
NCAR/mom6_forge
tests/test_source_bathy.py
.py
1cc7c8b6b80f1cbf
7.02
10
import pytest import xarray as xr import numpy as np from mom6_forge.topo import * from mom6_forge._source_bathy import SourceBathy from mom6_forge.grid import Grid def test_generate_mask_ocean_frac_raises_without_src(get_rect_topo_without_vc): """generate_mask_from_stats_ocean_frac must raise if src has not been...
NCAR/mom6_forge
tests/test_topo_bathymetry_workflows.py
.py
e69457150dc36ffa
7.02
10
from unittest.mock import MagicMock # --- active_cells --- def test_active_cells_empty(get_editor): """No selection returns empty list.""" assert get_editor.active_cells == [] def test_active_cells_single_cell(get_editor): """Single cell selection returns correct (j, i) tuple.""" get_editor._select...
NCAR/mom6_forge
tests/test_topo_editor.py
.py
1fca321dc972b87a
7.02
10