This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import sys | |
| import tmGrammar | |
| import tmTable | |
| def parse(expression): | |
| tmGrammar.Algorithm_Logic.clear() | |
| if not tmGrammar.Algorithm_parser(expression): | |
| raise ValueError("Failed to parse algorithm expression") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| version="$1" | |
| if [ -z "$1" ] | |
| then | |
| echo "usage: build-longterm <version>" | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env perl | |
| use File::Basename; | |
| # get the complete list of class names for replacement: | |
| my @src = (); | |
| my @rep = (); | |
| open FILELIST, "L1Trigger/L1TGlobal/scripts/files.txt"; | |
| while($fullfile = <FILELIST>){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run instrument emulations | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet.emulator.keithley.k707 -p 11001' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet.emulator.keithley.k2410 -p 11002' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet.emulator.keithley.k2657a -p 11003' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet.emulator.keithley.k6517b -p 11004' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet_pqc.emulator.e4980a -p 11005' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet_pqc.emulator.environmentbox -p 11006' | |
| gnome-terminal --tab -- /bin/bash -c '. env/bin/activate; python -m comet.emulator.corvus.venus1 -p 11007' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| version=$1 | |
| if [ -z "$version" ]; then | |
| echo "usage: $0 <version>" | |
| exit 1 | |
| fi | |
| install_dir="./envs/comet-pqc-$version" | |
| if [ -d "$install_dir" ]; then | |
| echo "directory already exists: $install_dir" | |
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename T> | |
| const typename T::mapped_type& at(const T& m, const typename T::key_type& k, const typename T::mapped_type& d) | |
| { | |
| try { return m.at(k); } catch (const std::out_of_range&) { return d; }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def linspace(start, stop, count): | |
| delta = (stop - start) / max(1, count - 1) | |
| return [start + i * delta for i in range(count)] | |
| def sample(data, count): | |
| n = len(data) | |
| count = min(n, count) | |
| return [int(round(i)) for i in linspace(0, len(data) - 1, count)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bisect_asc(arr): | |
| if len(arr): | |
| return arr[-1] < arr[0] | |
| return True | |
| def bisect_cmp(arr): | |
| if bisect_asc(arr): | |
| return lambda x, y: x > y | |
| return lambda x, y: x < y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| __all__ = ['round_half_away_from_zero'] | |
| def round_half_away_from_zero(n: float, decimals: int = 0) -> float: | |
| multiplier: float = 10 ** decimals | |
| return math.copysign(math.floor(abs(n * multiplier) + 0.5) / multiplier, n) |