id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,288,000 | pota.py | cwhelchel_hunterlog/src/pota/pota.py | import requests
import logging as L
import urllib.parse
from utils.callsigns import get_basecall
from version import __version__
logging = L.getLogger("potaApi")
SPOT_URL = "https://api.pota.app/spot/activator"
SPOT_COMMENTS_URL = "https://api.pota.app/spot/comments/{act}/{park}"
ACTIVATOR_URL = "https://api.pota.ap... | 3,283 | Python | .py | 87 | 28.793103 | 77 | 0.59038 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,001 | stats.py | cwhelchel_hunterlog/src/pota/stats.py | import csv
import os
from dataclasses import dataclass
@dataclass
class LocationStat:
hunts: int
activations: int
class PotaStats:
'''
This class exposes some POTA statistics calculated from the user's hunter
and activator csv files.
'''
def __init__(self, hunt_file: str, act_file: str ... | 3,876 | Python | .py | 97 | 29.391753 | 79 | 0.575951 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,002 | __init__.py | cwhelchel_hunterlog/src/alembic_src/__init__.py | # import logging
# log = logging.basicConfig(filename='alembic.log',
# encoding='utf-8',
# format='%(asctime)s %(message)s',
# level=logging.DEBUG) | 208 | Python | .py | 5 | 40.6 | 55 | 0.507389 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,003 | script.py.mako | cwhelchel_hunterlog/src/alembic_src/script.py.mako | """${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: U... | 635 | Python | .py | 18 | 33.388889 | 71 | 0.720854 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,004 | env.py | cwhelchel_hunterlog/src/alembic_src/env.py | # from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# ... | 2,193 | Python | .py | 59 | 32.491525 | 82 | 0.71334 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,005 | d087ce5d50a6_add_loc_hunts_col.py | cwhelchel_hunterlog/src/alembic_src/versions/d087ce5d50a6_add_loc_hunts_col.py | """add loc_hunts col
Revision ID: d087ce5d50a6
Revises: 6f1777640ea8
Create Date: 2024-03-05 21:46:31.654161
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'd087ce5d50a6'
down_revision: Union[str, None] = '6f1777640ea8'... | 597 | Python | .py | 17 | 33.117647 | 77 | 0.747811 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,006 | 922a7b854b71_fix_spot_source.py | cwhelchel_hunterlog/src/alembic_src/versions/922a7b854b71_fix_spot_source.py | """fix spot source
Revision ID: 922a7b854b71
Revises: dfc792b4b40b
Create Date: 2024-03-25 21:44:36.970584
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '922a7b854b71'
down_revision: Union[str, None] = 'dfc792b4b40b'
b... | 788 | Python | .py | 20 | 36.95 | 80 | 0.741765 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,007 | 6f1777640ea8_add_location_stats.py | cwhelchel_hunterlog/src/alembic_src/versions/6f1777640ea8_add_location_stats.py | """add location stats
Revision ID: 6f1777640ea8
Revises: de225609f3b5
Create Date: 2024-03-04 15:36:28.763615
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '6f1777640ea8'
down_revision: Union[str, None] = 'de225609f3b5... | 977 | Python | .py | 29 | 28.931034 | 62 | 0.678381 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,008 | ccdd7352ed32_add_rig_interface_type.py | cwhelchel_hunterlog/src/alembic_src/versions/ccdd7352ed32_add_rig_interface_type.py | """add rig interface type
Revision ID: ccdd7352ed32
Revises: 44ec51a942f9
Create Date: 2024-04-16 08:57:36.695892
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'ccdd7352ed32'
down_revision: Union[str, None] = '44ec51a9... | 674 | Python | .py | 18 | 35.277778 | 88 | 0.744977 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,009 | 53ee59dfaf8f_more_spot_data.py | cwhelchel_hunterlog/src/alembic_src/versions/53ee59dfaf8f_more_spot_data.py | """more spot data
Revision ID: 53ee59dfaf8f
Revises: 5daac9aa5d91
Create Date: 2024-03-13 19:15:22.059262
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '53ee59dfaf8f'
down_revision: Union[str, None] = '5daac9aa5d91'
br... | 704 | Python | .py | 19 | 34.736842 | 75 | 0.730769 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,010 | 5daac9aa5d91_add_loc_total_col.py | cwhelchel_hunterlog/src/alembic_src/versions/5daac9aa5d91_add_loc_total_col.py | """add loc total col
Revision ID: 5daac9aa5d91
Revises: d087ce5d50a6
Create Date: 2024-03-06 15:16:32.199996
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '5daac9aa5d91'
down_revision: Union[str, None] = 'd087ce5d50a6'... | 601 | Python | .py | 17 | 33.117647 | 77 | 0.742609 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,011 | dfc792b4b40b_add_logger_config.py | cwhelchel_hunterlog/src/alembic_src/versions/dfc792b4b40b_add_logger_config.py | """add logger config
Revision ID: dfc792b4b40b
Revises: 53ee59dfaf8f
Create Date: 2024-03-16 18:35:12.835407
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'dfc792b4b40b'
down_revision: Union[str, None] = '53ee59dfaf8f'... | 603 | Python | .py | 17 | 33.470588 | 80 | 0.752166 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,012 | __init__.py | cwhelchel_hunterlog/src/alembic_src/versions/__init__.py | '''copied from https://stackoverflow.com/a/74875605'''
"""DB migrations"""
from pathlib import Path
import os
import sys
from alembic.config import Config
from alembic import command
from alembic import config
def get_app_global_path():
'''Returns the correct location for a bundled pyinstaller executable file'''... | 1,321 | Python | .py | 31 | 38.83871 | 80 | 0.730769 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,013 | 3c58d5fd6e23_add_win_size_cfg.py | cwhelchel_hunterlog/src/alembic_src/versions/3c58d5fd6e23_add_win_size_cfg.py | """add win size cfg
Revision ID: 3c58d5fd6e23
Revises: ac1e18c1148f
Create Date: 2024-04-10 13:25:32.699482
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '3c58d5fd6e23'
down_revision: Union[str, None] = 'ac1e18c1148f'
... | 851 | Python | .py | 21 | 37.904762 | 85 | 0.718293 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,014 | ac1e18c1148f_add_bearing.py | cwhelchel_hunterlog/src/alembic_src/versions/ac1e18c1148f_add_bearing.py | """add bearing
Revision ID: ac1e18c1148f
Revises: 922a7b854b71
Create Date: 2024-04-10 11:10:44.670763
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'ac1e18c1148f'
down_revision: Union[str, None] = '922a7b854b71'
branc... | 583 | Python | .py | 17 | 32.294118 | 72 | 0.748654 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,015 | f01009b22b92_add_win_pos_cfg.py | cwhelchel_hunterlog/src/alembic_src/versions/f01009b22b92_add_win_pos_cfg.py | """add_win_pos_cfg
Revision ID: f01009b22b92
Revises: ccdd7352ed32
Create Date: 2024-04-29 19:53:08.433752
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'f01009b22b92'
down_revision: Union[str, None] = 'ccdd7352ed32'
b... | 672 | Python | .py | 19 | 33.052632 | 59 | 0.725155 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,016 | de225609f3b5_.py | cwhelchel_hunterlog/src/alembic_src/versions/de225609f3b5_.py | """empty message
Revision ID: de225609f3b5
Revises:
Create Date: 2024-03-02 18:47:24.752899
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'de225609f3b5'
down_revision: Union[str, None] = None
branch_labels: Union[str,... | 591 | Python | .py | 19 | 28.736842 | 60 | 0.731794 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,017 | db9920460979_add_rig_mode_opts.py | cwhelchel_hunterlog/src/alembic_src/versions/db9920460979_add_rig_mode_opts.py | """add rig mode opts
Revision ID: db9920460979
Revises: 3c58d5fd6e23
Create Date: 2024-04-11 12:45:55.107737
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'db9920460979'
down_revision: Union[str, None] = '3c58d5fd6e23'... | 724 | Python | .py | 19 | 35.842105 | 83 | 0.728838 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,018 | 44ec51a942f9_add_config_qthmsg.py | cwhelchel_hunterlog/src/alembic_src/versions/44ec51a942f9_add_config_qthmsg.py | """add config qthmsg
Revision ID: 44ec51a942f9
Revises: db9920460979
Create Date: 2024-04-15 14:11:31.707574
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '44ec51a942f9'
down_revision: Union[str, None] = 'db9920460979'... | 600 | Python | .py | 17 | 33.294118 | 78 | 0.750871 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,019 | you2text.py | jhnwnstd_linguist_toolkit/you2text.py | import yt_dlp
from pathlib import Path
from typing import Optional
import re
import unicodedata
# Pre-compiled regex patterns for filename sanitization
ILLEGAL_CHAR_PATTERN = re.compile(r'[^\w\s-]')
SPACE_PATTERN = re.compile(r'\s+')
YOUTUBE_URL_REGEX = re.compile(
r'^(https?://)?(www\.)?'
r'(youtube\.com/watc... | 8,016 | Python | .py | 180 | 35.522222 | 114 | 0.603585 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,020 | audio_converter.py | jhnwnstd_linguist_toolkit/audio_converter.py | import yt_dlp
from pathlib import Path
import unicodedata
import re
# Configuration options
VERBOSE = False # Toggle True for verbose output
# Pre-compiled regex patterns for filename sanitization
ILLEGAL_CHAR_PATTERN = re.compile(r'[^\w\s-]')
SPACE_PATTERN = re.compile(r'\s+')
YOUTUBE_URL_REGEX = re.compile(
r'... | 6,138 | Python | .py | 131 | 38.755725 | 127 | 0.628739 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,021 | image_to_text.py | jhnwnstd_linguist_toolkit/image_to_text.py | import logging
import multiprocessing
import re
import subprocess
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
import cv2
import numpy as np
import pytesseract
from PIL import Image
from tqdm import tqdm
# Specify the Tesseract command path if it's not in the s... | 5,342 | Python | .py | 98 | 46.040816 | 164 | 0.668656 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,022 | you2wav.py | jhnwnstd_linguist_toolkit/you2wav.py | import yt_dlp
from pathlib import Path
import unicodedata
import re
import logging
from typing import Optional, List, Tuple
from concurrent.futures import ThreadPoolExecutor, as_completed
# Configuration options
VERBOSE = False # Toggle True for verbose output
MAX_WORKERS = 8 # Number of threads for concur... | 9,707 | Python | .py | 198 | 36.671717 | 120 | 0.581075 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,023 | subtitle_cleaner.py | jhnwnstd_linguist_toolkit/subtitle_cleaner.py | import re
from pathlib import Path
from typing import List
import nltk
def process_subtitle_file(input_file: Path) -> List[str]:
"""
Processes the subtitle file by removing redundancy, cleaning up text,
and tokenizing sentences using NLTK, while preserving punctuation.
Args:
input_file (Path):... | 2,792 | Python | .py | 67 | 33.462687 | 100 | 0.622872 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,024 | youtube_downloader.py | jhnwnstd_linguist_toolkit/youtube_downloader.py | import yt_dlp
from pathlib import Path
import unicodedata
import re
import logging
from typing import Optional, Tuple
from concurrent.futures import ThreadPoolExecutor, as_completed
# Configuration options
VERBOSE = False # Toggle to True for verbose output
MAX_WORKERS = 8 # Number of threads for concurrent download... | 10,330 | Python | .py | 215 | 36.544186 | 119 | 0.589904 | jhnwnstd/linguist_toolkit | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,025 | plot.py | tum-pbs_StableBPTT/CartPole/Plots/01/plot.py | import numpy as np
import matplotlib.pyplot as plt
colors = ['#ef476f','#ffd166','#06d6a0','#073b4c']
labels={'F':"R",'P':'M','C':"C",'S':'S'}
gfm_dict = {
'F':0,
'P':1,
'C':2,
'S':3
}
def smooth(a):
kernel_size = 30
kernel = np.ones(kernel_size) / kernel_size
a_ext = np.concatenate([a[0... | 1,742 | Python | .py | 52 | 28.942308 | 64 | 0.614371 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,026 | multi_cartpole_controller.py | tum-pbs_StableBPTT/CartPole/Simulations/01/multi_cartpole_controller.py | import tensorflow as tf
def build_fully_connected_network(width, depth, use_bias, use_zero_initialization,n_poles):
activation = tf.keras.activations.tanh
layers = []
layers.append(tf.keras.layers.InputLayer(input_shape=(1+n_poles,2)))
layers.append(tf.keras.layers.Reshape((-1,)))
for _ in range... | 917 | Python | .py | 22 | 34.318182 | 91 | 0.664036 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,027 | training.py | tum-pbs_StableBPTT/CartPole/Simulations/01/training.py | import tensorflow as tf
import time
import numpy as np
from loss_formulation import LOSS_FORMULATION
def combine_grads(grad_i_base,grad_i_comp):
sign_base = tf.math.sign(grad_i_base)
sign_comp = tf.math.sign(grad_i_comp)
cond = sign_base==sign_comp
return tf.where(cond,grad_i_base,0)
def combine_grad... | 5,234 | Python | .py | 129 | 30.891473 | 98 | 0.586728 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,028 | start.py | tum-pbs_StableBPTT/CartPole/Simulations/01/start.py | from multi_cartpole_data import generate_data
from multi_cartpole_controller import build_fully_connected_network
from cartpole_simulator import build_cartpole_step,build_cartpole_loss
from loss_formulation import LOSS_FORMULATION
from training import TRAINING_SETUP
import tensorflow as tf
import numpy as np
import ar... | 3,956 | Python | .py | 86 | 43.872093 | 118 | 0.69435 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,029 | multi_cartpole_data.py | tum-pbs_StableBPTT/CartPole/Simulations/01/multi_cartpole_data.py | import numpy as np
def generate_data(N,n_poles):
# x,x_dot,theta,theta_dot
train_states = np.random.rand(N,n_poles+1,2).astype(np.float32)
train_states = train_states*2-1
train_states[:, 1:, 0] = np.pi + train_states[:, 1:,0] * np.pi/6
test_states = np.random.rand(N,n_poles+1,2).astype(np.float3... | 470 | Python | .py | 10 | 41.5 | 68 | 0.646532 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,030 | cartpole_simulator.py | tum-pbs_StableBPTT/CartPole/Simulations/01/cartpole_simulator.py | ### CARTPOLE ###
import tensorflow as tf
def build_cartpole_step(dt):
g = 9.8
m = 0.1 # mass pole
M = 1.1 #total mass = mass pole + mass cart
l = 0.5 #length
ml = m * l
@tf.function
def cartpole_step(state,force):
"""
multiple poles
state: batch, object i (cart, ... | 1,673 | Python | .py | 48 | 26.604167 | 65 | 0.548712 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,031 | loss_formulation.py | tum-pbs_StableBPTT/CartPole/Simulations/01/loss_formulation.py | import tensorflow as tf
stop = tf.stop_gradient
class LOSS_FORMULATION():
def __init__(self, simulator_time_step, controller, loss_function, Nt, gradient_flow, loss_mode):
self.simulator_time_step = simulator_time_step
self.controller = controller
self.loss_function = loss_function
... | 2,084 | Python | .py | 51 | 31.137255 | 101 | 0.592483 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,032 | plot.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Plots/01/plot.py | import numpy as np
import matplotlib.pyplot as plt
colors = ['#ef476f','#ffd166','#06d6a0','#073b4c']
gfm_dict = {'F':0,'P':1,'C':2,'S':3}
regu_dict={0.001:4, 0.01:3, 0.1:2, 1.0:1}
labels={'F':"R",'P':'M','C':"C",'S':'S'}
def smooth(a):
kernel_size = 30
kernel = np.ones(kernel_size) / kernel_size
a_ext =... | 2,045 | Python | .py | 57 | 31.140351 | 64 | 0.62069 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,033 | training.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/training.py | import tensorflow as tf
import time
import numpy as np
from loss_formulation import LOSS_FORMULATION
def combine_grads(grad_i_base,grad_i_comp):
sign_base = tf.math.sign(grad_i_base)
sign_comp = tf.math.sign(grad_i_comp)
cond = sign_base==sign_comp
return tf.where(cond,grad_i_base,0)
def combine_grad_... | 5,483 | Python | .py | 132 | 31.848485 | 98 | 0.588878 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,034 | start.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/start.py | from data import generate_data
from controller import build_fully_connected_network
from simulator import DRIVER_EVADER_SYSTEM
from training import TRAINING_SETUP
import tensorflow as tf
import numpy as np
import argparse,os
#tf.config.run_functions_eagerly(True)
parser = argparse.ArgumentParser(description='CmdLine... | 4,307 | Python | .py | 94 | 43.776596 | 137 | 0.68484 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,035 | controller.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/controller.py | import tensorflow as tf
def build_fully_connected_network(width, depth, use_bias, use_zero_initialization,n_dr,n_ev):
activation = tf.keras.activations.tanh
layers = []
layers.append(tf.keras.layers.InputLayer(input_shape=(n_dr+n_ev,2,2)))
layers.append(tf.keras.layers.Reshape((-1,)))
for _ in r... | 980 | Python | .py | 23 | 35.391304 | 93 | 0.662105 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,036 | loss_formulation.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/loss_formulation.py | import tensorflow as tf
stop = tf.stop_gradient
class LOSS_FORMULATION():
def __init__(self, simulator_time_step, controller, loss_function,
Nt, loss_mode, regu_coef,gradient_flow):
self.simulator_time_step = simulator_time_step
self.controller = controller
self.loss_fun... | 2,309 | Python | .py | 54 | 32.759259 | 71 | 0.597321 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,037 | simulator.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/simulator.py | import tensorflow as tf
'''
x
0: batch
1: number
2: x , v
3: x,y direction
dimensions: None,2,2,2
batch,number(de),x/v,dimension
'''
class DRIVER_EVADER_SYSTEM():
def __init__(self,n_drivers,n_evaders,epsilon=0.1) -> None:
self.n_drivers = n_drivers
self.n_evaders = n_evaders
self.epsilo... | 5,927 | Python | .py | 142 | 29.690141 | 86 | 0.52915 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,038 | data.py | tum-pbs_StableBPTT/GuidanceByRepulsion/Simulations/01/data.py | import numpy as np
def generate_data(Nd, n_dr,n_ev):
N=2*Nd
np.random.seed(42)
states = np.zeros((N,n_dr+n_ev,2,2)).astype(np.float32)
def rectangle(N,xmin,xmax,ymin,ymax):
x = np.random.rand(N,).astype(np.float32)
y = np.random.rand(N,).astype(np.float32)
x = (xmax-xmin) * x +... | 981 | Python | .py | 28 | 27.75 | 65 | 0.553895 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,039 | plot.py | tum-pbs_StableBPTT/QuantumControl/Plots/01/plot.py | import numpy as np
import matplotlib.pyplot as plt
colors = ['#ef476f','#ffd166','#06d6a0','#073b4c']
labels={'F':"R",'P':'M','C':"C",'S':'S'}
gfm_dict = {'F':0,'P':1,'C':2,'S':3}
def smooth(a):
kernel_size = 30
kernel = np.ones(kernel_size) / kernel_size
a_ext = np.concatenate([a[0]*np.ones((kernel_size... | 2,210 | Python | .py | 65 | 28.138462 | 80 | 0.596714 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,040 | qmc_start.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/qmc_start.py | from qmc_training_setup import TRAINING_SETUP
from qmc_solver import QMC
from model import get_cnn
from data import generate_data
import tensorflow as tf
import numpy as np
import argparse,os
parser = argparse.ArgumentParser(description='CmdLine Parser', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# MISC
... | 3,824 | Python | .py | 82 | 44.780488 | 140 | 0.687651 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,041 | qmc_training_setup.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/qmc_training_setup.py | from qmc_solver import *
from qmc_loss_formulation import *
import numpy as np
import time
def combine_grads(grad_i_base,grad_i_comp):
sign_base = tf.math.sign(grad_i_base)
sign_comp = tf.math.sign(grad_i_comp)
cond = sign_base==sign_comp
return tf.where(cond,grad_i_base,0)
def combine_grad_lists(gra... | 4,993 | Python | .py | 123 | 31.609756 | 98 | 0.59975 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,042 | qmc_solver.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/qmc_solver.py | import tensorflow as tf
from tensorflow.python.ops import gen_array_ops
import numpy as np
def normalize_probability(psi):
prob = np.abs(psi) ** 2
total_prob = np.sum(prob)
res = psi / (total_prob) ** 0.5
return res
@tf.function
def to_real(a_c):
a_r = tf.stack([tf.math.real(a_c), tf.math.imag(a... | 3,161 | Python | .py | 75 | 33.706667 | 117 | 0.57428 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,043 | model.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/model.py | import tensorflow as tf
def get_cnn(Nx,non,bias,zinit=True):
act = tf.keras.activations.tanh
model = tf.keras.models.Sequential([
tf.keras.layers.InputLayer(input_shape=(Nx,2)),
tf.keras.layers.Reshape((Nx,2,1)),
tf.keras.layers.Conv2D(non,(3,2),2, activation=act),
tf.keras.laye... | 737 | Python | .py | 20 | 29.9 | 67 | 0.62605 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,044 | qmc_loss_formulation.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/qmc_loss_formulation.py | import tensorflow as tf
from qmc_solver import to_complex,eigenstate
import numpy as np
stop = tf.stop_gradient
class LOSS_FORMULATION():
def __init__(self,network,solver,Nt,Nx,target_state,gradient_flow,loss_type):
self.solver = solver
self.network = network
self.Nt = Nt
self.Nx = ... | 2,518 | Python | .py | 65 | 27.676923 | 81 | 0.550524 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,045 | data.py | tum-pbs_StableBPTT/QuantumControl/Simulations/01/data.py | import numpy as np
from qmc_solver import *
def generate_data(N,Nx,weighting = '1-1'):
es1 = eigenstate(1, Nx).reshape((1, -1))
es2 = eigenstate(2, Nx).reshape((1, -1))
if weighting == '1-1':
w1,w2 = 1,1
elif weighting == '3-1':
w1,w2 = 3,1
elif weighting == '7-1':
w1,w2 =... | 921 | Python | .py | 26 | 30.076923 | 76 | 0.589888 | tum-pbs/StableBPTT | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,046 | main.py | password123456_some-tweak-to-hide-jwt-payload-values/main.py | import jwt
import base64
from datetime import datetime
import hashlib
# Get the current timestamp in seconds
def get_current_unix_timestamp():
return str(int(datetime.now().timestamp()))
# Convert the current Unix timestamp to a human-readable format
def get_human_readable_timestamp(timestamp):
current_date... | 3,249 | Python | .py | 63 | 47.126984 | 138 | 0.718483 | password123456/some-tweak-to-hide-jwt-payload-values | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,047 | backtest_visualization.ipynb | JurajZelman_airl-market-making/backtest_visualization.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Visualization of backtests\n",
"\n",
"This notebook can be used for the visualization of backtest results for the comparison of pure market making strategies and the trained AIRL strategy."
]
},
{
"cell_type": "code... | 32,669 | Python | .py | 1,134 | 24.337743 | 156 | 0.52456 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,048 | rl_generator.ipynb | JurajZelman_airl-market-making/rl_generator.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Reinforcement learning (generator)\n",
"\n",
"In this notebook, I implement a pure reinforcement learning agent. This is done to analyze the stability of training of the `generator` in the adversarial inverse reinforcement le... | 15,701 | Python | .py | 506 | 26.606719 | 417 | 0.558802 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,049 | imitation_airl.ipynb | JurajZelman_airl-market-making/imitation_airl.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Adversarial Inverse Reinforcement Learning\n",
"\n",
"This notebook contains the code for training the _Adversarial Inverse Reinforcement Learning_ (AIRL) algorithm from [Fu et al. (2018)](https://arxiv.org/abs/1710.11248) ut... | 26,681 | Python | .py | 881 | 25.886493 | 378 | 0.564806 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,050 | backtest_automation.ipynb | JurajZelman_airl-market-making/backtest_automation.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Market making backtests\n",
"\n",
"In this notebook I automate the generation of market making backtests for the thesis."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Initial setup"
... | 28,011 | Python | .py | 845 | 28.622485 | 108 | 0.480012 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,051 | experts.py | JurajZelman_airl-market-making/rl/experts.py | """Expert policies for imitation learning."""
import math
import gymnasium as gym
import numpy as np
class RandomPolicy_v1:
"""Random policy for the v1 problem."""
def __init__(self, action_space: gym.spaces.Space) -> None:
"""
Initialize the random policy.
Args:
action... | 1,543 | Python | .py | 44 | 26.181818 | 76 | 0.59097 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,052 | features.py | JurajZelman_airl-market-making/rl/features.py | """Feature processing methods."""
import datetime
from typing import Union
import numpy as np
import pandas as pd
import polars as pl
def get_features(
ts: pd.Timestamp, win: int, order_book: pl.DataFrame, time_step: float
) -> list:
"""
Get the features from the data.
Args:
ts: The timesta... | 4,829 | Python | .py | 148 | 25.412162 | 79 | 0.590157 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,053 | plotting.py | JurajZelman_airl-market-making/rl/plotting.py | """Methods for plotting and monitoring."""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.gridspec import GridSpec
def visualize_bc_train_stats(train_stats: dict):
"""
Visualize the training statistics of the behavior cloning agent.
Args:
train_stats: Training statistics.
... | 5,166 | Python | .py | 138 | 32.173913 | 78 | 0.635325 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,054 | rewards.py | JurajZelman_airl-market-making/rl/rewards.py | """Reward networks and reward functions."""
import gymnasium as gym
import torch as th
from imitation.rewards.reward_nets import RewardNet
from stable_baselines3.common import preprocessing
class NegativeRewardNet(RewardNet):
"""
Simple reward neural network (multi-layer perceptron) that ensures that the
... | 4,627 | Python | .py | 117 | 29.897436 | 80 | 0.604547 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,055 | utils.py | JurajZelman_airl-market-making/rl/utils.py | """Various helper functions for RL algorithms."""
import os
import pickle
from datetime import datetime, timedelta
from random import uniform
import torch as th
from imitation.rewards import reward_nets
from stable_baselines3.common import base_class
from stable_baselines3.ppo import PPO
def send_notification(messa... | 2,686 | Python | .py | 79 | 28.582278 | 74 | 0.678544 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,056 | environments.py | JurajZelman_airl-market-making/rl/environments.py | """Reinforcement learning environments."""
from datetime import datetime, timedelta
from typing import TypeVar
import gymnasium as gym
import numpy as np
from gymnasium.spaces import Box, Discrete
from lob.exchange import Exchange
from rl.utils import random_timestamp
ObsType = TypeVar("ObsType")
ActType = TypeVar(... | 5,809 | Python | .py | 155 | 27.341935 | 80 | 0.599645 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,057 | actions.py | JurajZelman_airl-market-making/rl/actions.py | """Methods related to actions of reinforcement learning agents."""
from typing import TypeVar
ActType = TypeVar("ActType")
# TODO: Update to the latest version of the environment
def decode_action_v1(action: ActType):
"""
Decode an action.
Args:
action: Action to decode.
"""
# If action... | 476 | Python | .py | 16 | 24.875 | 66 | 0.660793 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,058 | exchange.py | JurajZelman_airl-market-making/lob/exchange.py | """Exchange simulator."""
import copy
import os
import pickle
from datetime import datetime
from typing import TypeVar
import numpy as np
import pandas as pd
import polars as pl
from tqdm import tqdm
from lob.data import scan_parquet
from lob.distributions import EmpiricalOrderVolumeDistribution
from lob.limit_order... | 22,659 | Python | .py | 517 | 32.678917 | 80 | 0.522953 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,059 | orders.py | JurajZelman_airl-market-making/lob/orders.py | """Classes representing orders available at the market."""
import sys
from abc import ABC, abstractmethod
from datetime import datetime
class Order(ABC):
"""Abstract base class for orders."""
@abstractmethod
def __init__(
self,
ticker: str,
id: str,
trader_id: int,
... | 3,525 | Python | .py | 103 | 24.980583 | 80 | 0.566226 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,060 | order_queue.py | JurajZelman_airl-market-making/lob/order_queue.py | """Price order queue for orders of the same price."""
from pyllist import dllist, dllistnode
from lob.orders import Order
from lob.utils import round_to_lot
class OrderQueue:
"""
Price order queue for orders of the same price. The queue is implemented
as a double-linked list and is sorted by the entry t... | 5,131 | Python | .py | 126 | 31.404762 | 80 | 0.602891 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,061 | distributions.py | JurajZelman_airl-market-making/lob/distributions.py | """Module for sampling from the empirical distributions."""
import os
import numpy as np
import pandas as pd
class EmpiricalOrderVolumeDistribution:
"""
Class for sampling order volumes from the empirical distribution estimated
on the insample order book data.
"""
def __init__(self, rng: np.ran... | 1,537 | Python | .py | 42 | 27.952381 | 80 | 0.601615 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,062 | commissions.py | JurajZelman_airl-market-making/lob/commissions.py | """Commission models for computation of transaction costs."""
from abc import ABC, abstractmethod
class CommissionModel(ABC):
"""Abstract class for commission models."""
@abstractmethod
def maker_fee(self, quantity: float, price: float) -> float:
"""
Compute the maker fee.
Args:... | 8,270 | Python | .py | 234 | 23.08547 | 80 | 0.513128 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,063 | plots.py | JurajZelman_airl-market-making/lob/plots.py | """Plotting functionalities."""
import datetime
from typing import Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from lob.backtest_metrics import drawdowns
COLOR_GREEN = "#13961a"
COLOR_RED = "#eb5c14"
def set_plot_style() -> None:
"""Set the plotting style."""
plt.style.use... | 5,967 | Python | .py | 209 | 22.047847 | 80 | 0.597174 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,064 | time.py | JurajZelman_airl-market-making/lob/time.py | """Methods for handling of time and timestamps."""
import datetime
import polars as pl
class TimeManager:
"""Timeline class for timestamps management."""
def __init__(
self,
exchange: str,
symbol: str,
ts_start: datetime.datetime,
ts_end: datetime.datetime,
p... | 7,558 | Python | .py | 190 | 29.626316 | 80 | 0.576299 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,065 | utils.py | JurajZelman_airl-market-making/lob/utils.py | """Various helper functions for the lob package."""
import os
import random
import string
import numpy as np
import pandas as pd
def generate_second_timestamps(ts_start: pd.Timestamp, ts_end: pd.Timestamp):
"""
Generate a list of timestamps for each second between the start and end.
Args:
ts_st... | 3,346 | Python | .py | 97 | 27.865979 | 80 | 0.628927 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,066 | traders.py | JurajZelman_airl-market-making/lob/traders.py | """Implementations of market participants."""
import datetime
import math
import pickle
from abc import ABC, abstractmethod
from typing import Any, TypeVar
import numpy as np
import polars as pl
from lob.commissions import CommissionModel
from lob.limit_order_book import LimitOrderBook
from lob.orders import LimitOr... | 34,171 | Python | .py | 906 | 26.769316 | 80 | 0.524649 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,067 | limit_order_book.py | JurajZelman_airl-market-making/lob/limit_order_book.py | """Limit order book."""
import math
import os
from datetime import datetime
from typing import Optional, Union
import matplotlib.pyplot as plt
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
from pyllist import dllistnode
from sortedcontainers import SortedDict
from lob.order_queue import OrderQ... | 24,385 | Python | .py | 628 | 27.678344 | 80 | 0.549911 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,068 | data.py | JurajZelman_airl-market-making/lob/data.py | """Methods for data handling and processing."""
import os
import pandas as pd
import polars as pl
from lob.time import TimeManager
def scan_parquet(
name: str,
ts_start: pd.Timestamp,
ts_end: pd.Timestamp,
win: int,
path: str,
time_manager: TimeManager,
) -> pl.DataFrame:
"""
Scan th... | 1,925 | Python | .py | 47 | 35.170213 | 76 | 0.657571 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,069 | backtest_metrics.py | JurajZelman_airl-market-making/lob/backtest_metrics.py | """Metrics for evaluating the performance of a trading strategy."""
import numpy as np
import pandas as pd
def total_return(equity: pd.Series) -> float:
"""
Compute the total return of a strategy in percent.
Args:
equity: Equity curve of the strategy.
Returns:
The total return in pe... | 4,383 | Python | .py | 142 | 24.950704 | 78 | 0.655601 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,070 | imitation_reward_wrapper.py | JurajZelman_airl-market-making/package_modifications/imitation_reward_wrapper.py | """Common wrapper for adding custom reward values to an environment."""
import collections
from typing import Deque
import numpy as np
from imitation.data import types
from imitation.rewards import reward_function
from stable_baselines3.common import callbacks
from stable_baselines3.common import logger as sb_logger
... | 5,012 | Python | .py | 111 | 36.396396 | 86 | 0.647867 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,071 | sb3_common_utils.py | JurajZelman_airl-market-making/package_modifications/sb3_common_utils.py | import glob
import math # TODO:
import os
import platform
import random
import re
import sys # TODO:
from collections import deque
from itertools import zip_longest
from typing import Dict, Iterable, List, Optional, Tuple, Union
import cloudpickle
import gymnasium as gym
import numpy as np
import stable_baselines3 a... | 21,859 | Python | .py | 536 | 34.294776 | 113 | 0.670875 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,072 | imitation_adversarial_common.py | JurajZelman_airl-market-making/package_modifications/imitation_adversarial_common.py | """Core code for adversarial imitation learning, shared between GAIL and AIRL."""
import abc
import dataclasses
import logging
import os # TODO:
from datetime import datetime # TODO:
from typing import (
Callable,
Iterable,
Iterator,
Mapping,
Optional,
Type,
overload,
)
import numpy as np... | 31,672 | Python | .py | 683 | 34.458272 | 88 | 0.592038 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,073 | sb3_logger.py | JurajZelman_airl-market-making/package_modifications/sb3_logger.py | import datetime
import json
import os
import sys
import tempfile
import warnings
from collections import defaultdict
from io import TextIOBase
from typing import (
Any,
Dict,
List,
Mapping,
Optional,
Sequence,
TextIO,
Tuple,
Union,
)
import matplotlib.figure
import numpy as np
impor... | 25,710 | Python | .py | 675 | 29.014815 | 120 | 0.576748 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,074 | imitation_bc.py | JurajZelman_airl-market-making/package_modifications/imitation_bc.py | """Behavioural Cloning (BC).
Trains policy by applying supervised learning to a fixed dataset of (observation,
action) pairs generated by some expert demonstrator.
"""
import dataclasses
import itertools
from typing import (
Any,
Callable,
Iterable,
Iterator,
Mapping,
Optional,
Tuple,
... | 20,732 | Python | .py | 476 | 32.798319 | 92 | 0.603667 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,075 | order_book_data_analysis.ipynb | JurajZelman_airl-market-making/data_processing/order_book_data_analysis.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exploratory analysis of lob data\n",
"\n",
"In this notebook I explore the datasets and plot some of the data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source... | 33,814 | Python | .py | 1,171 | 24.507259 | 135 | 0.506908 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,076 | downloaders.py | JurajZelman_airl-market-making/data_processing/downloaders.py | """Methods for dowloading and processing the data."""
import datetime
import os
import lakeapi
import pandas as pd
from data.utils import (
get_list_of_second_timestamps,
get_parquet_args,
get_rnd_id,
)
def download_lob_data(
date: datetime.datetime,
symbol: str,
exchange: str,
path: st... | 10,317 | Python | .py | 264 | 32.333333 | 80 | 0.615968 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,077 | trade_data_pipeline.ipynb | JurajZelman_airl-market-making/data_processing/trade_data_pipeline.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Trade data pipeline\n",
"\n",
"Full pipeline for downloading and processing trade data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",... | 2,583 | Python | .py | 117 | 18.094017 | 104 | 0.548256 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,078 | trade_data_analysis.ipynb | JurajZelman_airl-market-making/data_processing/trade_data_analysis.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exploratory analysis of trade data\n",
"\n",
"In this notebook I explore the datasets and plot some of the data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"sour... | 16,801 | Python | .py | 624 | 22.661859 | 148 | 0.549855 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,079 | utils.py | JurajZelman_airl-market-making/data_processing/utils.py | """Helper functions for the data analysis."""
import datetime
import os
import random
import matplotlib.pyplot as plt
def set_plot_style() -> None:
"""Set the plotting style."""
plt.style.use("seaborn-v0_8")
plt.rcParams.update(
{"axes.prop_cycle": plt.cycler("color", plt.cm.tab10.colors)}
... | 2,209 | Python | .py | 53 | 36.811321 | 80 | 0.681159 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,080 | volume_analysis.ipynb | JurajZelman_airl-market-making/data_processing/volume_analysis.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# LOB volumes analysis\n",
"\n",
"The goal of this notebook is to preprocess sample distributions for each level of the order book from which one can sample random volumes that can be used in the simulation, e.g. for simulating... | 6,896 | Python | .py | 240 | 24.445833 | 234 | 0.527344 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,081 | data_cleaning.ipynb | JurajZelman_airl-market-making/data_processing/data_cleaning.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data cleaning\n",
"\n",
"This notebook is used for the cleaning of few outliers in the SOL-USDT dataset from the BIT.COM exchange where the top ask price skyrocketed to something like 120 from ~20 USDT. This would be worth me... | 4,769 | Python | .py | 156 | 26.352564 | 346 | 0.542814 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,082 | order_book_data_pipeline.ipynb | JurajZelman_airl-market-making/data_processing/order_book_data_pipeline.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Limit Order Book data pipeline\n",
"\n",
"Full pipeline for downloading and processing the limit order book data."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source... | 2,493 | Python | .py | 111 | 18.45045 | 104 | 0.549958 | JurajZelman/airl-market-making | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,083 | errors.py | WillJRoper_h5forest/src/h5forest/errors.py | """A module containing functions for graceful error handling."""
def error_handler(func):
"""
Wrap a function in a try/except block to catch errors.
Errors are printed to the mini buffer.
Args:
func (function):
The function to wrap.
"""
def wrapper(*args, **kwargs):
... | 754 | Python | .py | 21 | 27.333333 | 75 | 0.612948 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,084 | tree.py | WillJRoper_h5forest/src/h5forest/tree.py | """Tree class for the HDF5 file viewer.
This module contains the Tree class which is used to represent the HDF5 file
as a tree structure. The Tree contains Nodes which are used to represent the
groups and datasets in the HDF5 file. Each Node is lazy loaded, meaning that
its children are only loaded when it is opened.
... | 9,023 | Python | .py | 229 | 29.467249 | 79 | 0.595969 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,085 | plotting.py | WillJRoper_h5forest/src/h5forest/plotting.py | """A module for plotting with matplotlib directly from the HDF5 file.
This is only ever called from the h5forest module and is not intended to be
used directly by the user.
"""
import os
import threading
import warnings
import h5py
import matplotlib.pyplot as plt
import numpy as np
from prompt_toolkit.application im... | 19,169 | Python | .py | 496 | 26.366935 | 79 | 0.522313 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,086 | utils.py | WillJRoper_h5forest/src/h5forest/utils.py | """A module containing utility functions and classes for the HDF5 viewer."""
import os
class DynamicTitle:
"""
A class to represent a dynamic title for the application.
This can be used to update any title in the application dynamically.
Attributes:
title (str): The title to display.
"... | 1,112 | Python | .py | 34 | 25.647059 | 76 | 0.616901 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,087 | h5_forest.py | WillJRoper_h5forest/src/h5forest/h5_forest.py | """The main application for the HDF5 Forest.
This application provides a CLI application for exploring HDF5 files. This is
enabled by the h5forest entry point set up when the package is installed.
Example Usage:
h5forest /path/to/file.hdf5
"""
import sys
from prompt_toolkit import Application
from prompt_toolk... | 25,689 | Python | .py | 690 | 26.163768 | 78 | 0.575246 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,088 | progress.py | WillJRoper_h5forest/src/h5forest/progress.py | """A module containing a custom progress bar.
This module contains a custom progress bar that can be used to display
progress in the application. This is needed because the prompt_toolkit
ProgressBar doesn't work within widget based applications. Additionally the
tqdm would require redirecting stdout and stderr which ... | 3,827 | Python | .py | 97 | 30.659794 | 79 | 0.625202 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,089 | node.py | WillJRoper_h5forest/src/h5forest/node.py | """This module contains the Node class for the HDF5 file viewer.
The Node class is used to represent a Group/Dataset in the HDF5 file. Nodes
can be linked via parent/child relationships to form a tree structure
representing the HDF5 file. A Node is lazy loaded, i.e. it only opens the
HDF5 file when it is expanded. Thi... | 20,301 | Python | .py | 486 | 28.092593 | 79 | 0.519911 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,090 | styles.py | WillJRoper_h5forest/src/h5forest/styles.py | from prompt_toolkit.styles import Style
style = Style.from_dict(
{
"group": "bold",
"highlighted": "reverse",
"group highlighted": "bold reverse",
"under_cursor": "blink",
}
)
| 217 | Python | .py | 9 | 18.555556 | 44 | 0.589372 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,091 | tree_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/tree_bindings.py | """A module containing the keybindings for the file tree.
This module contains the keybinding functions for the file tree. The functions
in this module should not be called directly, but are intended to be used by
the application.
"""
from prompt_toolkit.document import Document
from prompt_toolkit.filters import Con... | 3,125 | Python | .py | 89 | 25.921348 | 78 | 0.600663 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,092 | hist_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/hist_bindings.py | """A module containing the bindings for the histogram class.
This module contains the function that defines the bindings for the histogram
and attaches them to the application. It should not be used directly.
"""
from prompt_toolkit.document import Document
from prompt_toolkit.filters import Condition
from prompt_too... | 6,573 | Python | .py | 157 | 31.203822 | 78 | 0.590388 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,093 | dataset_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/dataset_bindings.py | """A module containing the keybindings for the dataset mode.
This module contains the keybindings for the dataset mode. This mode is
activated when the user selects a dataset in the tree view. The dataset
mode allows the user to interact with the dataset, such as viewing the
values, getting the minimum and maximum, me... | 7,268 | Python | .py | 187 | 28.534759 | 74 | 0.579818 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,094 | __init__.py | WillJRoper_h5forest/src/h5forest/bindings/__init__.py | from h5forest.bindings.hist_bindings import _init_hist_bindings
from h5forest.bindings.plot_bindings import _init_plot_bindings
from h5forest.bindings.window_bindings import _init_window_bindings
from h5forest.bindings.jump_bindings import _init_jump_bindings
from h5forest.bindings.dataset_bindings import _init_dataset... | 452 | Python | .py | 7 | 63.571429 | 69 | 0.860674 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,095 | plot_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/plot_bindings.py | """This module contains the keybindings for the plotting mode.
The functions in this module are used to define the keybindings for the
plotting mode and attach them to the application. It should not be used
directly.
"""
from prompt_toolkit.document import Document
from prompt_toolkit.filters import Condition
from pr... | 7,090 | Python | .py | 178 | 29.252809 | 79 | 0.579385 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,096 | window_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/window_bindings.py | """A module for binding window events to functions.
This module contains the functions for binding window events to functions. This
should not be used directly, but instead provides the functions for the
application.
"""
from prompt_toolkit.filters import Condition
from prompt_toolkit.layout.containers import Conditi... | 3,530 | Python | .py | 98 | 26.295918 | 79 | 0.587665 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,097 | jump_bindings.py | WillJRoper_h5forest/src/h5forest/bindings/jump_bindings.py | """This module contains the keybindings for the jump mode.
The jump mode is a mode that allows the user to quickly navigate the tree using
a set of keybindings. This is useful for large trees where the user knows the
name of the node they want to jump to.
This module defines the functions for binding jump mode events ... | 5,827 | Python | .py | 140 | 31.571429 | 79 | 0.593329 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,098 | bindings.py | WillJRoper_h5forest/src/h5forest/bindings/bindings.py | """A module containing the keybindings for the basic UI.
This module contains the keybindings for the basic UI. These keybindings are
always active and are not dependent on any leader key. The functions in this
module should not be called directly, but are intended to be used by the main
application.
"""
from prompt_... | 3,657 | Python | .py | 104 | 27.913462 | 77 | 0.633134 | WillJRoper/h5forest | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,288,099 | r.py | TheNobody-12_MOT_WITH_YOLOV9_STRONG_SORT/r.py | ...
for path, im, im0s, vid_cap, s in dataset:
# s = ''
t1 = time_sync()
with dt[0]:
im = torch.from_numpy(im).to(model.device)
im = im.half() if model.fp16 else im.float() # uint8 to fp16/32
im /= 255 # 0 - 255 to 0.0 - 1.0
if len(im.shape) == 3:
im = im[None]... | 2,281 | Python | .py | 52 | 34.692308 | 103 | 0.546847 | TheNobody-12/MOT_WITH_YOLOV9_STRONG_SORT | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:26 PM (Europe/Amsterdam) |