Skip to content

Commit

Permalink
address pre-commit failure
Browse files Browse the repository at this point in the history
  • Loading branch information
knolan10 committed Aug 28, 2024
1 parent 0aabbde commit 38fc145
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- loop
pull_request:

permissions:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ To run the deprecated `scripts/alert-stats.py` script, you can run:
PYTHONPATH=. python scripts/alert-stats.py --feature='candidate.magpsf,candidate.sigmapsf' --programids=1,2 --plot=True --start=2460355.5 --nb_days=1 --sp_token=<your_sp_token> --sp_groupIDs=41 --sp_filterIDs=1 --nb_bins=1000 --k_token=<your_kowalski_token>
```

- [X] Fetch all the features of all alert packets within a given time range with given program ids and store it as a pandas dataframe
- [X] Fetch all of the candidates that passed filters in Fritz (with exact candid, not just objectIds). Relies on the new /api/candidates_filter endpoint.
- [x] Fetch all the features of all alert packets within a given time range with given program ids and store it as a pandas dataframe
- [x] Fetch all of the candidates that passed filters in Fritz (with exact candid, not just objectIds). Relies on the new /api/candidates_filter endpoint.
- [ ] Looking at the subset of alerts that passed the filters, find the obj_id of the sources that were saved in Fritz.
- [ ] Update the dataframe with a column containing the list of filters passed for each alert, and a column containing the groupIDs for each alert which obj has been saved as a source to the groups associated to the filters passed.
- [ ] Figure out what visualizations tools and plots we can use to represent the data in a meaningful way and extract insights from it.
Expand Down
2 changes: 1 addition & 1 deletion frigate/utils/frigatemain.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ def process_candidates(args):
output_directory=args.output_directory,
)

print(f"Saved candidates to {filepath}")
print(f"Saved candidates to {filepath}")
34 changes: 26 additions & 8 deletions frigate/utils/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,34 @@ def stats_parser_args():

return args


def loop_parser():
parser = argparse.ArgumentParser(description='Run frigate with specified parameters.')
parser.add_argument("--programids", type=str, default="1,2,3", help="Program IDs to query")
parser.add_argument('--start', nargs='+', required=True, help='List of start values')
parser.add_argument("--nb_days", type=float, default=1.0, help="Number of days to query")
parser = argparse.ArgumentParser(
description="Run frigate with specified parameters."
)
parser.add_argument(
"--programids", type=str, default="1,2,3", help="Program IDs to query"
)
parser.add_argument(
"--start", nargs="+", required=True, help="List of start values"
)
parser.add_argument(
"--nb_days", type=float, default=1.0, help="Number of days to query"
)
parser.add_argument("--sp_token", type=str, default=None, help="Skyportal token")
parser.add_argument("--k_token", type=str, default=None, help="Kowalski token")
parser.add_argument("--groupids", type=str, default="*", help="SkyPortal Group IDs to query")
parser.add_argument("--filterids", type=str, help="SkyPortal/Kowalski Filter IDs to query")
parser.add_argument("--output_format", type=str, default="parquet", help="Output format for the results")
parser.add_argument(
"--groupids", type=str, default="*", help="SkyPortal Group IDs to query"
)
parser.add_argument(
"--filterids", type=str, help="SkyPortal/Kowalski Filter IDs to query"
)
parser.add_argument(
"--output_format",
type=str,
default="parquet",
help="Output format for the results",
)
parser.add_argument(
"--n_threads",
type=str,
Expand Down Expand Up @@ -254,7 +272,7 @@ def loop_parser():


def loop_parser_args():
args = loop_parser().parse_args()
args = loop_parser().parse_args()
if not args.k_token:
# we try to get the token from the environment if it is not provided here
k_token_env = os.environ.get("KOWALSKI_TOKEN")
Expand Down
2 changes: 1 addition & 1 deletion scripts/loop-frigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
args.end = args.start + args.nb_days
process_candidates(args)
except Exception as e:
print(f"Error occurred while running the command for start value {start}: {e}")
print(f"Error occurred while running the command for start value {start}: {e}")

0 comments on commit 38fc145

Please sign in to comment.