Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNF posrec urlconfig fix #1519

Merged
merged 12 commits into from
Jan 24, 2025
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mistune = "==0.8.4"
pymongo = "*"
requests = "*"
utilix = ">=0.11.0"
xedocs = "*"
xedocs = ">=0.2.32"
commonmark = { version = "0.9.1", optional = true }
nbsphinx = { version = "0.8.9", optional = true }
recommonmark = { version = "0.7.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion straxen/config/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_item_or_attr(obj, key, default=None):

@URLConfig.register("resource")
def get_resource(name: str, fmt: str = "text", readable: bool = False, **kwargs):
"""Fetch a straxen resource Allow a direct download using <fmt='abs_path'> otherwise kwargs are
"""Fetch a straxen resource, allow a direct download using <fmt='abs_path'> otherwise kwargs are
passed directly to straxen.get_resource."""
if fmt == "abs_path":
downloader = utilix.mongo_storage.MongoDownloader()
Expand Down
11 changes: 6 additions & 5 deletions straxen/plugins/peaklets/peaklet_positions_cnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PeakletPositionsCNF(PeakletPositionsBase):
- sig: Confidence level of the contour
- log_area_scale: Scaling parameter for log area
- n_top_pmts: Number of top PMTs
- pred_function: Path to the compiled JAX function for predictions
- cnf_pred_function: Path to the compiled JAX function for predictions

"""

Expand Down Expand Up @@ -56,10 +56,11 @@ class PeakletPositionsCNF(PeakletPositionsBase):
help="Scaling parameter for log area",
)

pred_function = straxen.URLConfig(
cnf_pred_function = straxen.URLConfig(
default=(
"jax://resource://flow_20240730.tar.gz?"
"n_poly=plugin.n_poly&sig=plugin.sig&fmt=abs_path"
"jax://resource://xedocs://posrec_models"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this PR only work after https://github.com/XENONnT/corrections/pull/314 is merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Currently xedocs hasn't been synced anyway, so it is also waiting on that. I told @LuisSanchez25 about https://github.com/XENONnT/corrections/pull/314 so he will wait till that is merged before syncing

"?kind=cnf&attr=value&n_poly=plugin.n_poly&sig=plugin.sig&fmt=abs_path"
"&version=ONLINE&run_id=plugin.run_id"
),
help="Compiled JAX function",
)
Expand Down Expand Up @@ -150,7 +151,7 @@ def vectorized_prediction_chunk(self, flow_condition):
else:
inputs = np.zeros((self.N_chunk_max, self.n_top_pmts + 1))
inputs[:N_entries] = flow_condition
xy, contour = self.pred_function(inputs)
xy, contour = self.cnf_pred_function(inputs)
return xy[:N_entries], contour[:N_entries]

def prediction_loop(self, flow_condition):
Expand Down
Loading