From f8d9017cada2ff8ef7902809b8ee61e6947b3339 Mon Sep 17 00:00:00 2001 From: Kira Date: Wed, 1 Jul 2026 22:29:42 -0700 Subject: [PATCH] more major restructuring in setup --- .copier-answers.yml | 17 ----- .git_archival.txt | 4 - .gitattributes | 24 ------ .github/ISSUE_TEMPLATE/0-general_issue.md | 8 -- .github/ISSUE_TEMPLATE/1-bug_report.md | 28 ------- .github/ISSUE_TEMPLATE/2-feature_request.md | 18 ----- .github/ISSUE_TEMPLATE/README.md | 9 --- .github/dependabot.yml | 10 --- .github/pull_request_template.md | 13 ---- .github/workflows/README.md | 9 --- .github/workflows/asv-main.yml | 68 ----------------- .github/workflows/asv-nightly.yml | 72 ------------------ .github/workflows/asv-pr.yml | 70 ------------------ .github/workflows/pre-commit-ci.yml | 37 ---------- .github/workflows/publish-benchmarks-pr.yml | 53 -------------- .github/workflows/publish-to-pypi.yml | 38 ---------- .pre-commit-config.yaml | 46 +----------- .setup_dev.sh | 51 ------------- README.md | 6 +- benchmarks/README.md | 12 --- benchmarks/__init__.py | 0 benchmarks/asv.conf.json | 81 --------------------- benchmarks/benchmarks.py | 16 ---- src/thor/crossmatch_alerts.py | 4 +- 24 files changed, 7 insertions(+), 687 deletions(-) delete mode 100644 .copier-answers.yml delete mode 100644 .git_archival.txt delete mode 100644 .gitattributes delete mode 100644 .github/ISSUE_TEMPLATE/0-general_issue.md delete mode 100644 .github/ISSUE_TEMPLATE/1-bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/2-feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/README.md delete mode 100644 .github/dependabot.yml delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/README.md delete mode 100644 .github/workflows/asv-main.yml delete mode 100644 .github/workflows/asv-nightly.yml delete mode 100644 .github/workflows/asv-pr.yml delete mode 100644 .github/workflows/pre-commit-ci.yml delete mode 100644 .github/workflows/publish-benchmarks-pr.yml delete mode 100644 .github/workflows/publish-to-pypi.yml delete mode 100755 .setup_dev.sh delete mode 100644 benchmarks/README.md delete mode 100644 benchmarks/__init__.py delete mode 100644 benchmarks/asv.conf.json delete mode 100644 benchmarks/benchmarks.py diff --git a/.copier-answers.yml b/.copier-answers.yml deleted file mode 100644 index a9328da..0000000 --- a/.copier-answers.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Changes here will be overwritten by Copier -_commit: v2.2.0 -_src_path: gh:lincc-frameworks/python-project-template -author_email: kinolan@unc.edu -author_name: Kira Nolan -custom_install: retrofit -include_docs: false -package_name: thor -project_description: '' -project_license: MIT -project_name: THOR -project_organization: knolan10 -python_versions: -- '3.10' -- '3.11' -- '3.12' -- '3.13' diff --git a/.git_archival.txt b/.git_archival.txt deleted file mode 100644 index b1a286b..0000000 --- a/.git_archival.txt +++ /dev/null @@ -1,4 +0,0 @@ -node: $Format:%H$ -node-date: $Format:%cI$ -describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ -ref-names: $Format:%D$ \ No newline at end of file diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 343a755..0000000 --- a/.gitattributes +++ /dev/null @@ -1,24 +0,0 @@ -# For explanation of this file and uses see -# https://git-scm.com/docs/gitattributes -# https://developer.lsst.io/git/git-lfs.html#using-git-lfs-enabled-repositories -# https://lincc-ppt.readthedocs.io/en/latest/practices/git-lfs.html -# -# Used by https://github.com/lsst/afwdata.git -# *.boost filter=lfs diff=lfs merge=lfs -text -# *.dat filter=lfs diff=lfs merge=lfs -text -# *.fits filter=lfs diff=lfs merge=lfs -text -# *.gz filter=lfs diff=lfs merge=lfs -text -# -# apache parquet files -# *.parq filter=lfs diff=lfs merge=lfs -text -# -# sqlite files -# *.sqlite3 filter=lfs diff=lfs merge=lfs -text -# -# gzip files -# *.gz filter=lfs diff=lfs merge=lfs -text -# -# png image files -# *.png filter=lfs diff=lfs merge=lfs -text - -.git_archival.txt export-subst \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/0-general_issue.md b/.github/ISSUE_TEMPLATE/0-general_issue.md deleted file mode 100644 index 84bb0d7..0000000 --- a/.github/ISSUE_TEMPLATE/0-general_issue.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: General issue -about: Quickly create a general issue -title: '' -labels: '' -assignees: '' - ---- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/1-bug_report.md b/.github/ISSUE_TEMPLATE/1-bug_report.md deleted file mode 100644 index 153d1bd..0000000 --- a/.github/ISSUE_TEMPLATE/1-bug_report.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Bug report -about: Tell us about a problem to fix -title: 'Short description' -labels: 'bug' -assignees: '' - ---- -**Bug report** - - -**Environment Information** - - -
-Traceback - -FILL IN YOUR STACK TRACE HERE - -
- -**Before submitting** -Please check the following: - -- [ ] I have described the situation in which the bug arose, including what code was executed, and any applicable data others will need to reproduce the problem. -- [ ] I have included information about my environment, including the version of this package (e.g. `thor.__version__`) -- [ ] I have included available evidence of the unexpected behavior (including error messages, screenshots, and/or plots) as well as a description of what I expected instead. -- [ ] If I have a solution in mind, I have provided an explanation and/or pseudocode and/or task list. diff --git a/.github/ISSUE_TEMPLATE/2-feature_request.md b/.github/ISSUE_TEMPLATE/2-feature_request.md deleted file mode 100644 index 908ff72..0000000 --- a/.github/ISSUE_TEMPLATE/2-feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: 'Short description' -labels: 'enhancement' -assignees: '' - ---- - -**Feature request** - - -**Before submitting** -Please check the following: - -- [ ] I have described the purpose of the suggested change, specifying what I need the enhancement to accomplish, i.e. what problem it solves. -- [ ] I have included any relevant links, screenshots, environment information, and data relevant to implementing the requested feature, as well as pseudocode for how I want to access the new functionality. -- [ ] If I have ideas for how the new feature could be implemented, I have provided explanations and/or pseudocode and/or task lists for the steps. diff --git a/.github/ISSUE_TEMPLATE/README.md b/.github/ISSUE_TEMPLATE/README.md deleted file mode 100644 index 46dc08e..0000000 --- a/.github/ISSUE_TEMPLATE/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Configurations - -Templates for various different issue types are defined in this directory -and a pull request template is defined as ``../pull_request_template.md``. Adding, -removing, and modifying these templates to suit the needs of your project is encouraged. - -For more information about these templates, look here: https://lincc-ppt.readthedocs.io/en/latest/practices/issue_pr_templating.html - -Or if you still have questions contact us: https://lincc-ppt.readthedocs.io/en/latest/source/contact.html \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 3b5ca19..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "monthly" - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "monthly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 5f341fd..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,13 +0,0 @@ -## Change Description - - -## Solution Description - - -## Code Quality -- [ ] I have read the Contribution Guide and agree to the Code of Conduct -- [ ] My code follows the code style of this project -- [ ] My code builds (or compiles) cleanly without any errors or warnings -- [ ] My code contains relevant comments and necessary documentation diff --git a/.github/workflows/README.md b/.github/workflows/README.md deleted file mode 100644 index e34a71f..0000000 --- a/.github/workflows/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Workflows - -The .yml files in this directory are used to define the various continuous -integration scripts that will be run on your behalf e.g. nightly as a smoke check, -or when you create a new PR. - -For more information about CI and workflows, look here: https://lincc-ppt.readthedocs.io/en/latest/practices/ci.html - -Or if you still have questions contact us: https://lincc-ppt.readthedocs.io/en/latest/source/contact.html \ No newline at end of file diff --git a/.github/workflows/asv-main.yml b/.github/workflows/asv-main.yml deleted file mode 100644 index 9b952ab..0000000 --- a/.github/workflows/asv-main.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This workflow will run benchmarks with airspeed velocity (asv), -# store the new results in the "benchmarks" branch and publish them -# to a dashboard on GH Pages. -name: Run ASV benchmarks for main - -on: - push: - branches: [ main ] - -env: - PYTHON_VERSION: "3.11" - ASV_VERSION: "0.6.5" - WORKING_DIR: ${{github.workspace}}/benchmarks - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - asv-main: - runs-on: ubuntu-latest - permissions: - contents: write - defaults: - run: - working-directory: ${{env.WORKING_DIR}} - steps: - - name: Set up Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v6 - with: - python-version: ${{env.PYTHON_VERSION}} - - name: Checkout main branch of the repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Install dependencies - run: pip install asv[virtualenv]==${{env.ASV_VERSION}} - - name: Configure git - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Create ASV machine config file - run: asv machine --machine gh-runner --yes - - name: Fetch previous results from the "benchmarks" branch - run: | - if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then - git merge origin/benchmarks \ - --allow-unrelated-histories \ - --no-commit - mv ../_results . - fi - - name: Run ASV for the main branch - run: asv run ALL --skip-existing --verbose || true - - name: Submit new results to the "benchmarks" branch - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: benchmarks - folder: ${{env.WORKING_DIR}}/_results - target-folder: _results - - name: Generate dashboard HTML - run: | - asv show - asv publish - - name: Deploy to Github pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: gh-pages - folder: ${{env.WORKING_DIR}}/_html \ No newline at end of file diff --git a/.github/workflows/asv-nightly.yml b/.github/workflows/asv-nightly.yml deleted file mode 100644 index 7d0607b..0000000 --- a/.github/workflows/asv-nightly.yml +++ /dev/null @@ -1,72 +0,0 @@ -# This workflow will run daily at 06:45. -# It will run benchmarks with airspeed velocity (asv) -# and compare performance with the previous nightly build. -name: Run benchmarks nightly job - -on: - schedule: - - cron: 45 6 * * * - workflow_dispatch: - -env: - PYTHON_VERSION: "3.11" - ASV_VERSION: "0.6.5" - WORKING_DIR: ${{github.workspace}}/benchmarks - NIGHTLY_HASH_FILE: nightly-hash - -jobs: - asv-nightly: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{env.WORKING_DIR}} - steps: - - name: Set up Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v6 - with: - python-version: ${{env.PYTHON_VERSION}} - - name: Checkout main branch of the repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Install dependencies - run: pip install asv[virtualenv]==${{env.ASV_VERSION}} - - name: Configure git - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Create ASV machine config file - run: asv machine --machine gh-runner --yes - - name: Fetch previous results from the "benchmarks" branch - run: | - if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then - git merge origin/benchmarks \ - --allow-unrelated-histories \ - --no-commit - mv ../_results . - fi - - name: Get nightly dates under comparison - id: nightly-dates - run: | - echo "yesterday=$(date -d yesterday +'%Y-%m-%d')" >> $GITHUB_OUTPUT - echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Use last nightly commit hash from cache - uses: actions/cache@v5 - with: - path: ${{env.WORKING_DIR}} - key: nightly-results-${{steps.nightly-dates.outputs.yesterday}} - - name: Run comparison of main against last nightly build - run: | - HASH_FILE=${{env.NIGHTLY_HASH_FILE}} - CURRENT_HASH=${{github.sha}} - if [ -f $HASH_FILE ]; then - PREV_HASH=$(cat $HASH_FILE) - asv continuous $PREV_HASH $CURRENT_HASH --verbose || true - asv compare $PREV_HASH $CURRENT_HASH --sort ratio --verbose - fi - echo $CURRENT_HASH > $HASH_FILE - - name: Update last nightly hash in cache - uses: actions/cache@v5 - with: - path: ${{env.WORKING_DIR}} - key: nightly-results-${{steps.nightly-dates.outputs.today}} \ No newline at end of file diff --git a/.github/workflows/asv-pr.yml b/.github/workflows/asv-pr.yml deleted file mode 100644 index 014c382..0000000 --- a/.github/workflows/asv-pr.yml +++ /dev/null @@ -1,70 +0,0 @@ -# This workflow will run benchmarks with airspeed velocity (asv) for pull requests. -# It will compare the performance of the main branch with the performance of the merge -# with the new changes. It then publishes a comment with this assessment by triggering -# the publish-benchmarks-pr workflow. -# Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. -name: Run benchmarks for PR - -on: - pull_request: - branches: [ main ] - workflow_dispatch: - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -env: - PYTHON_VERSION: "3.11" - ASV_VERSION: "0.6.5" - WORKING_DIR: ${{github.workspace}}/benchmarks - ARTIFACTS_DIR: ${{github.workspace}}/artifacts - -jobs: - asv-pr: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{env.WORKING_DIR}} - steps: - - name: Set up Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v6 - with: - python-version: ${{env.PYTHON_VERSION}} - - name: Checkout PR branch of the repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Display Workflow Run Information - run: | - echo "Workflow Run ID: ${{github.run_id}}" - - name: Install dependencies - run: pip install asv[virtualenv]==${{env.ASV_VERSION}} lf-asv-formatter - - name: Make artifacts directory - run: mkdir -p ${{env.ARTIFACTS_DIR}} - - name: Save pull request number - run: echo ${{github.event.pull_request.number}} > ${{env.ARTIFACTS_DIR}}/pr - - name: Get current job logs URL - uses: Tiryoh/gha-jobid-action@v1 - id: jobs - with: - github_token: ${{secrets.GITHUB_TOKEN}} - job_name: ${{github.job}} - - name: Create ASV machine config file - run: asv machine --machine gh-runner --yes - - name: Save comparison of PR against main branch - run: | - git remote add upstream https://github.com/${{github.repository}}.git - git fetch upstream - asv continuous upstream/main HEAD --verbose || true - asv compare upstream/main HEAD --sort ratio --verbose | tee output - python -m lf_asv_formatter --asv_version "$(asv --version | awk '{print $2}')" - printf "\n\nClick [here]($STEP_URL) to view all benchmarks." >> output - mv output ${{env.ARTIFACTS_DIR}} - env: - STEP_URL: ${{steps.jobs.outputs.html_url}}#step:10:1 - - name: Upload artifacts (PR number and benchmarks output) - uses: actions/upload-artifact@v6 - with: - name: benchmark-artifacts - path: ${{env.ARTIFACTS_DIR}} \ No newline at end of file diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml deleted file mode 100644 index 392feed..0000000 --- a/.github/workflows/pre-commit-ci.yml +++ /dev/null @@ -1,37 +0,0 @@ - -# This workflow runs pre-commit hooks on pushes and pull requests to main -# to enforce coding style. To ensure correct configuration, please refer to: -# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html -name: Run pre-commit hooks - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - pre-commit-ci: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: Install dependencies - run: | - sudo apt-get update - uv pip install --system .[dev] - if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi - - uses: pre-commit/action@v3.0.1 - with: - extra_args: --all-files --verbose - env: - SKIP: "check-lincc-frameworks-template-version,no-commit-to-branch,check-added-large-files,validate-pyproject,sphinx-build,pytest-check" - - uses: pre-commit-ci/lite-action@v1.1.0 - if: failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false \ No newline at end of file diff --git a/.github/workflows/publish-benchmarks-pr.yml b/.github/workflows/publish-benchmarks-pr.yml deleted file mode 100644 index 1076890..0000000 --- a/.github/workflows/publish-benchmarks-pr.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This workflow publishes a benchmarks comment on a pull request. It is triggered after the -# benchmarks are computed in the asv-pr workflow. This separation of concerns allows us limit -# access to the target repository private tokens and secrets, increasing the level of security. -# Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. -name: Publish benchmarks comment to PR - -on: - workflow_run: - workflows: ["Run benchmarks for PR"] - types: [completed] - -jobs: - upload-pr-comment: - runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - permissions: - issues: write - pull-requests: write - steps: - - name: Display Workflow Run Information - run: | - echo "Workflow Run ID: ${{ github.event.workflow_run.id }}" - echo "Head SHA: ${{ github.event.workflow_run.head_sha }}" - echo "Head Branch: ${{ github.event.workflow_run.head_branch }}" - echo "Conclusion: ${{ github.event.workflow_run.conclusion }}" - echo "Event: ${{ github.event.workflow_run.event }}" - - name: Download artifact - uses: dawidd6/action-download-artifact@v12 - with: - name: benchmark-artifacts - run_id: ${{ github.event.workflow_run.id }} - - name: Extract artifacts information - id: pr-info - run: | - printf "PR number: $(cat pr)\n" - printf "Output:\n$(cat output)" - printf "pr=$(cat pr)" >> $GITHUB_OUTPUT - - name: Find benchmarks comment - uses: peter-evans/find-comment@v4 - id: find-comment - with: - issue-number: ${{ steps.pr-info.outputs.pr }} - comment-author: 'github-actions[bot]' - body-includes: view all benchmarks - - name: Create or update benchmarks comment - uses: peter-evans/create-or-update-comment@v5 - with: - comment-id: ${{ steps.find-comment.outputs.comment-id }} - issue-number: ${{ steps.pr-info.outputs.pr }} - body-path: output - edit-mode: replace \ No newline at end of file diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml deleted file mode 100644 index 8bfbcbc..0000000 --- a/.github/workflows/publish-to-pypi.yml +++ /dev/null @@ -1,38 +0,0 @@ - -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://github.com/pypa/gh-action-pypi-publish#trusted-publishing - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - deploy: - - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - - uses: actions/checkout@v6 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c22b94c..c531798 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,61 +1,19 @@ - repos: - # Compare the local template version to the latest remote template version - # This hook should always pass. It will print a message if the local version - # is out of date. - - repo: https://github.com/lincc-frameworks/pre-commit-hooks - rev: v0.2.2 - hooks: - - id: check-lincc-frameworks-template-version - name: Check template version - description: Compare current template version against latest - verbose: true - # Clear output from jupyter notebooks so that only the input cells are committed. + # Clear output from Jupyter notebooks before committing - repo: local hooks: - id: jupyter-nb-clear-output name: Clear output from Jupyter notebooks description: Clear output from Jupyter notebooks. files: \.ipynb$ - exclude: ^docs/pre_executed stages: [pre-commit] language: system entry: jupyter nbconvert --clear-output - # Prevents committing directly branches named 'main' and 'master'. + # Prevent committing directly to main - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: no-commit-to-branch name: Prevent main branch commits - description: Prevent the user from committing directly to the primary branch. - id: check-added-large-files - name: Check for large files - description: Prevent the user from committing very large files. args: ['--maxkb=500'] - # Verify that pyproject.toml is well formed - - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.24.1 - hooks: - - id: validate-pyproject - name: Validate pyproject.toml - description: Verify that pyproject.toml adheres to the established schema. - # Verify that GitHub workflows are well formed - - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.0 - hooks: - - id: check-github-workflows - args: ["--verbose"] - # Run unit tests, verify that they pass. Note that coverage is run against - # the ./src directory here because that is what will be committed. In the - # github workflow script, the coverage is run against the installed package - # and uploaded to Codecov by calling pytest like so: - # `python -m pytest --cov= --cov-report=xml` - - repo: local - hooks: - - id: pytest-check - name: Run unit tests - description: Run unit tests with pytest. - entry: bash -c "if python -m pytest --co -qq; then python -m pytest --cov=./src --cov-report=html; fi" - language: system - pass_filenames: false - always_run: true diff --git a/.setup_dev.sh b/.setup_dev.sh deleted file mode 100755 index 5286e41..0000000 --- a/.setup_dev.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -# Bash Unofficial strict mode (http://redsymbol.net/articles/unofficial-bash-strict-mode/) -# and (https://disconnected.systems/blog/another-bash-strict-mode/) -set -o nounset # Any uninitialized variable is an error -set -o errexit # Exit the script on the failure of any command to execute without error -set -o pipefail # Fail command pipelines on the failure of any individual step -IFS=$'\n\t' #set internal field separator to avoid iteration errors -# Trap all exits and output something helpful -trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR - -# This script should be run by new developers to install this package in -# editable mode and configure their local environment - -echo "Checking virtual environment" -if [ "${VIRTUAL_ENV:-missing}" = "missing" ] && [ "${CONDA_PREFIX:-missing}" = "missing" ]; then - echo 'No virtual environment detected: none of $VIRTUAL_ENV or $CONDA_PREFIX is set.' - echo - echo "=== This script is going to install the project in the system python environment ===" - echo "Proceed? [y/N]" - read -r RESPONCE - if [ "${RESPONCE}" != "y" ]; then - echo "See https://lincc-ppt.readthedocs.io/ for details." - echo "Exiting." - exit 1 - fi - -fi - -echo "Checking pip version" -MINIMUM_PIP_VERSION=22 -pipversion=( $(python -m pip --version | awk '{print $2}' | sed 's/\./\n\t/g') ) -if let "${pipversion[0]}<${MINIMUM_PIP_VERSION}"; then - echo "Insufficient version of pip found. Requires at least version ${MINIMUM_PIP_VERSION}." - echo "See https://lincc-ppt.readthedocs.io/ for details." - exit 1 -fi - -echo "Installing package and runtime dependencies in local environment" -python -m pip install -e . > /dev/null - -echo "Installing developer dependencies in local environment" -python -m pip install -e .'[dev]' > /dev/null -if [ -f docs/requirements.txt ]; then python -m pip install -r docs/requirements.txt > /dev/null; fi - -echo "Installing pre-commit" -pre-commit install > /dev/null - -####################################################### -# Include any additional configurations below this line -####################################################### diff --git a/README.md b/README.md index 47f2408..6252557 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Some [example notebooks](docs/notebooks/) demonstrate fetching and filtering LSS To fetch and visualise LSST alerts for a given night, run: ```bash - `python src/thor/summarize_rubin_alerts.py 07-01-2026 07-02-2026` + python src/thor/summarize_rubin_alerts.py 07-01-2026 07-02-2026 ``` This uses the Babamul alert broker to fetch alerts, which requires user credentials stored in a .env file locally. Omit dates to default to the previous night. The generated skymap is saved to `data/plots/` @@ -27,10 +27,10 @@ This uses the Babamul alert broker to fetch alerts, which requires user credenti To fetch alerts, crossmatch against available catalogs, and save candidates, run: ```bash -python src/thor/crossmatch_alerts.py --start 06-28-2026 --end 06-30-2026 --additional_filtering tde_filter --scan +python src/thor/crossmatch_alerts.py --start 06-28-2026 --end 06-30-2026 --additional_filtering tde_filter ``` -If there are any matches, the crossmatch result is saved to `data/lsst_alert_download/crossmatch_candidates_{timestamp}.json`. To apply additional TDE-specific filtering, pass `--additional_filtering tde_filter`. Add flag `--save` to save raw alerts to `data/lsst_alert_download/raw_files/`, and flag `--save_results` in order to save the crossmatch details locally to `data/lsst_alert_download/`. A summary of results will be printed in command line, but the --scan flag can also be included to open a temp jupyter notebook in browser and use Babamul's scanning tool. +To apply additional TDE-specific filtering, pass `--additional_filtering tde_filter`. Add flag `--save_raw_alerts` to save raw alerts to `data/lsst_alert_download/raw_files/`, and flag `--save_results` in order to save the crossmatch details locally to `data/lsst_alert_download/`. A summary of results will be printed in command line, but the `--scan` flag can also be included to open a temp jupyter notebook in browser and use Babamul's scanning tool. ### Data diff --git a/benchmarks/README.md b/benchmarks/README.md deleted file mode 100644 index 5259778..0000000 --- a/benchmarks/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Benchmarks - -This directory contains files that will be run via continuous testing either -nightly or after committing code to a pull request. - -The runtime and/or memory usage of the functions defined in these files will be -tracked and reported to give you a sense of the overall performance of your code. - -You are encouraged to add, update, or remove benchmark functions to suit the needs -of your project. - -For more information, see the documentation here: https://lincc-ppt.readthedocs.io/en/latest/practices/ci_benchmarking.html \ No newline at end of file diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json deleted file mode 100644 index bf125b7..0000000 --- a/benchmarks/asv.conf.json +++ /dev/null @@ -1,81 +0,0 @@ - -{ - // The version of the config file format. Do not change, unless - // you know what you are doing. - "version": 1, - // The name of the project being benchmarked. - "project": "THOR", - // The project's homepage. - "project_url": "https://github.com/knolan10/THOR", - // The URL or local path of the source code repository for the - // project being benchmarked. - "repo": "..", - // List of branches to benchmark. If not provided, defaults to "master" - // (for git) or "tip" (for mercurial). - "branches": [ - "HEAD" - ], - "install_command": [ - "python -m pip install {wheel_file}" - ], - "build_command": [ - "python -m build --wheel -o {build_cache_dir} {build_dir}" - ], - // The DVCS being used. If not set, it will be automatically - // determined from "repo" by looking at the protocol in the URL - // (if remote), or by looking for special directories, such as - // ".git" (if local). - "dvcs": "git", - // The tool to use to create environments. May be "conda", - // "virtualenv" or other value depending on the plugins in use. - // If missing or the empty string, the tool will be automatically - // determined by looking for tools on the PATH environment - // variable. - "environment_type": "virtualenv", - // the base URL to show a commit for the project. - "show_commit_url": "https://github.com/knolan10/THOR/commit/", - // The Pythons you'd like to test against. If not provided, defaults - // to the current version of Python used to run `asv`. - "pythons": [ - "3.11" - ], - // The matrix of dependencies to test. Each key is the name of a - // package (in PyPI) and the values are version numbers. An empty - // list indicates to just test against the default (latest) - // version. - "matrix": { - "Cython": [], - "build": [], - "packaging": [] - }, - // The directory (relative to the current directory) that benchmarks are - // stored in. If not provided, defaults to "benchmarks". - "benchmark_dir": ".", - // The directory (relative to the current directory) to cache the Python - // environments in. If not provided, defaults to "env". - "env_dir": "env", - // The directory (relative to the current directory) that raw benchmark - // results are stored in. If not provided, defaults to "results". - "results_dir": "_results", - // The directory (relative to the current directory) that the html tree - // should be written to. If not provided, defaults to "html". - "html_dir": "_html", - // The number of characters to retain in the commit hashes. - // "hash_length": 8, - // `asv` will cache wheels of the recent builds in each - // environment, making them faster to install next time. This is - // number of builds to keep, per environment. - "build_cache_size": 8 - // The commits after which the regression search in `asv publish` - // should start looking for regressions. Dictionary whose keys are - // regexps matching to benchmark names, and values corresponding to - // the commit (exclusive) after which to start looking for - // regressions. The default is to start from the first commit - // with results. If the commit is `null`, regression detection is - // skipped for the matching benchmark. - // - // "regressions_first_commits": { - // "some_benchmark": "352cdf", // Consider regressions only after this commit - // "another_benchmark": null, // Skip regression detection altogether - // } -} \ No newline at end of file diff --git a/benchmarks/benchmarks.py b/benchmarks/benchmarks.py deleted file mode 100644 index 5673c82..0000000 --- a/benchmarks/benchmarks.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Two sample benchmarks to compute runtime and memory usage. - -For more information on writing benchmarks: -https://asv.readthedocs.io/en/stable/writing_benchmarks.html.""" - -from thor import example_benchmarks - - -def time_computation(): - """Time computations are prefixed with 'time'.""" - example_benchmarks.runtime_computation() - - -def mem_list(): - """Memory computations are prefixed with 'mem' or 'peakmem'.""" - return example_benchmarks.memory_computation() diff --git a/src/thor/crossmatch_alerts.py b/src/thor/crossmatch_alerts.py index abeb2c2..310b3a3 100644 --- a/src/thor/crossmatch_alerts.py +++ b/src/thor/crossmatch_alerts.py @@ -121,7 +121,7 @@ def main(): help="Optional additional filter to apply after crossmatch (default: none).", ) parser.add_argument( - "--save", + "--save_raw_alerts", action="store_true", help="Save fetched alerts to data/lsst_alert_download/raw_files/ (default: off).", ) @@ -147,7 +147,7 @@ def main(): is_star=False, is_near_brightstar=False, is_stationary=True, - save=args.save, + save=args.save_raw_alerts, ) print(f"Loaded {len(loaded_alerts):,} alerts.")