Files
tianxuan/scripts/gen_1998_files.py
T
PM-pinou 9314ac6942 chore: bump version to v1.1.2
- New timeline UI: interleaved LLM reasoning + tool call display
- Fix: run_log truncation for large tool outputs
- Fix: lat/lon + values reduced to ~1% (was 99%)
- Fix: @csrf_exempt on upload/delete endpoints
- Fix: DATA_UPLOAD_MAX_NUMBER_FILES for 1998-file upload
- Fix: dtype alignment for multi-batch CSV processing
- New: tests/test_e2e_full.py with real DeepSeek LLM
- New: 1998-file test data generator
2026-07-20 23:32:32 +08:00

38 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Generate 1998 CSV files (0.csv..1997.csv) with realistic TLS data matching TlsDB.csv.
Usage: runtime\python\python.exe scripts\gen_1998_files.py [--rows-per-file N] [--output-dir DIR]
"""
import random, csv, argparse
from pathlib import Path
from datetime import datetime, timedelta
from gen_test_data import generate_row, COLUMNS as columns
random.seed(42)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--rows-per-file', type=int, default=5, help='Rows per CSV file')
parser.add_argument('--output-dir', type=str, default='data/multi_upload')
args = parser.parse_args()
out_dir = Path(args.output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
total = 1998
base_time = datetime(2026, 6, 1, 0, 0, 0)
for i in range(total):
filepath = out_dir / f'{i}.csv'
with open(filepath, 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=columns)
writer.writeheader()
for j in range(args.rows_per_file):
row_time = base_time + timedelta(seconds=random.randint(0, 86400 * 30))
row = generate_row(i * args.rows_per_file + j, row_time)
writer.writerow(row)
print(f'Generated {total} files × {args.rows_per_file} rows = {total * args.rows_per_file} total rows')
print(f'Output: {out_dir.resolve()}')
if __name__ == '__main__':
main()