Skip to content

Commit

Permalink
Merge branch 'main' into issue/36/dimension-hist
Browse files Browse the repository at this point in the history
  • Loading branch information
mtauraso authored Sep 17, 2024
2 parents 324fe8b + c8c433f commit 1426c1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
17 changes: 12 additions & 5 deletions src/fibad/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ def run(self):
return

# Create thread objects for each of our worker threads
num_threads = self.config.get("concurrent_connections", 2)
if num_threads > 5:
raise RuntimeError("This client only opens 5 connections or fewer.")
num_threads = self.config.get("concurrent_connections", 10)

Check warning on line 76 in src/fibad/download.py

View check run for this annotation

Codecov / codecov/patch

src/fibad/download.py#L76

Added line #L76 was not covered by tests

if num_threads > 10:
RuntimeError("More than 10 concurrent connections to HSC is disallowed on a per-user basis")

# If we are using more than one connection, cut the list of rectangles into
# batches, one batch for each thread.
Expand Down Expand Up @@ -423,6 +424,9 @@ def rect_from_config(config: dict) -> dC.Rect:
filter=config["filter"],
rerun=config["rerun"],
type=config["type"],
image=config.get("image"),
mask=config.get("mask"),
variance=config.get("variance"),
)

@staticmethod
Expand Down Expand Up @@ -471,7 +475,10 @@ def create_rects(
for index, location in enumerate(locations):
args = {field: location.get(field) for field in fields}

Check warning on line 476 in src/fibad/download.py

View check run for this annotation

Codecov / codecov/patch

src/fibad/download.py#L476

Added line #L476 was not covered by tests
args["lineno"] = index + offset

# tracts are ints in the fits files and dC.rect constructor wants them as str
args["tract"] = str(args["tract"])

# Sets the file name on the rect to be the object_id, also includes other rect fields
# which are interpolated at save time, and are native fields of dc.Rect.
args["name"] = str(
Expand All @@ -481,9 +488,9 @@ def create_rects(
rects.append(rect)

# We sort rects here so they end up tract,ra,dec ordered across all requests made in all threads
# Threads do their own sorting prior to each chunked request in downloadCutout.py; however
# Threads do their own sorting prior to all chunked request in downloadCutout.py; however
# sorting at this stage will allow a greater number of rects that are co-located in the sky
# to end up in the same thread and same chunk.
# to end up in the same thread and therefore be sorted into the same request.
rects.sort()

return rects
4 changes: 2 additions & 2 deletions src/fibad/downloadCutout/downloadCutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ class Rect:

rerun: str = default_rerun
type: str = default_type
filter: Union[str, list[str]] = ALLFILTERS
tract: int = ANYTRACT
filter: Union[str, list[str]] = ALLFILTERS
ra: float = math.nan
dec: float = math.nan
sw: float = math.nan
Expand All @@ -349,8 +349,8 @@ class Rect:
def create(
rerun: Union[str, None] = None,
type: Union[str, None] = None,
filter: Union[Union[str, list[str]], None] = None,
tract: Union[str, int, None] = None,
filter: Union[Union[str, list[str]], None] = None,
ra: Union[str, float, None] = None,
dec: Union[str, float, None] = None,
sw: Union[str, float, None] = None,
Expand Down
2 changes: 1 addition & 1 deletion src/fibad/fibad_default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ retries = 3
# `timepout` How long should we wait to get a full HTTP response from the server. Default 3600s (1hr)
timeout = 3600
# `chunksize` How many sky location rectangles should we request in a single request. Default is 990
chunksize = 990
chunk_size = 990

[model]
name = "ExampleAutoencoder"
Expand Down

0 comments on commit 1426c1f

Please sign in to comment.