Skip to content

Commit

Permalink
remove max_nppc
Browse files Browse the repository at this point in the history
  • Loading branch information
wanqqq31 committed Oct 1, 2024
1 parent 2418ec6 commit f13ff7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
8 changes: 1 addition & 7 deletions src/pfs_target_uploader/pn_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ def target_uploader_app(use_panel_cli=False):
else:
max_exetime = int(config["MAX_EXETIME"])

if "MAX_NPPC" not in config.keys():
max_nppc: int = 200
else:
max_nppc = int(config["MAX_NPPC"])

if "PPP_QUIET" not in config.keys():
ppp_quiet: bool = True
else:
Expand Down Expand Up @@ -88,7 +83,6 @@ def target_uploader_app(use_panel_cli=False):
logger.info("No upload ID database is used. Scan output directories directly.")

logger.info(f"Maximum execution time for the PPP is set to {max_exetime} sec.")
logger.info(f"Maximum number of PPCs is set to {max_nppc}.")

logger.info(f"config params from dotenv: {config}")

Expand Down Expand Up @@ -126,7 +120,7 @@ def target_uploader_app(use_panel_cli=False):

panel_results = ValidationResultWidgets()
panel_targets = TargetWidgets()
panel_ppp = PppResultWidgets(max_nppc=max_nppc)
panel_ppp = PppResultWidgets()

panel_input.reset()
panel_input.db_path = db_path
Expand Down
24 changes: 4 additions & 20 deletions src/pfs_target_uploader/utils/ppp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def PPPrunStart(
uPPC,
weight_para,
single_exptime: int = 900,
max_nppc: int = 200,
d_pfi=1.38,
quiet=True,
clustering_algorithm="HDBSCAN",
Expand All @@ -64,8 +63,6 @@ def PPPrunStart(
if weight_para is None:
weight_para = [2.02, 0.01, 0.01]

is_nppc = (max_nppc is not None) and (max_nppc > 0)

def count_N(sample):
"""calculate local count of targets
Expand Down Expand Up @@ -403,10 +400,6 @@ def PPP_centers(sample_f, ppc_f, mutiPro, weight_para, starttime):
sample_s = sample[sample["exptime_PPP"] > 0] # targets not finished

while any(sample_s["exptime_PPP"] > 0):
# NOTE: need a crors-check with He-san, probably.
if is_nppc and (len(peak) > max_nppc):
break

# -------------------------------
# ### peak_xy from KDE peak with weights
X_, Y_, obj_dis_sig_, peak_x, peak_y = KDE(sample_s, mutiPro)
Expand Down Expand Up @@ -920,7 +913,6 @@ def netflow_iter(uS, obj_allo, weight_para, starttime, status):
table of ppc information after all targets are assigned
# note that some targets in the dense region may need very long time to be assigned with fibers
# if targets can not be successfully assigned with fibers in >5 iterations, then directly stop
# if total number of ppc > max_nppc (~5 nights), then directly stop
"""

if sum(uS["exptime_assign"] == uS["exptime_PPP"]) == len(uS):
Expand All @@ -942,18 +934,10 @@ def netflow_iter(uS, obj_allo, weight_para, starttime, status):

obj_allo_t = netflowRun(uS_t2)

if is_nppc and (len(obj_allo) > max_nppc):
logger.info(
f"PPP stopped since Nppc > {max_nppc} [netflow_iter s2]"
)
break
else:
obj_allo = vstack([obj_allo, obj_allo_t])
obj_allo.remove_rows(
np.where(obj_allo["tel_fiber_usage_frac"] == 0)[0]
)
uS = complete_ppc(uS_t2, obj_allo)[0]
iter_m2 += 1
obj_allo = vstack([obj_allo, obj_allo_t])
obj_allo.remove_rows(np.where(obj_allo["tel_fiber_usage_frac"] == 0)[0])
uS = complete_ppc(uS_t2, obj_allo)[0]
iter_m2 += 1

return obj_allo, status

Expand Down
3 changes: 0 additions & 3 deletions src/pfs_target_uploader/widgets/PppResultWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class PppResultWidgets:

def __init__(
self,
max_nppc: int = 200, # max number of PPCs
):
# PPP status
# True if PPP has been run
Expand All @@ -35,7 +34,6 @@ def __init__(
self.origdata_ppc = None
self.upload_time = None
self.secret_token = None
self.max_nppc = max_nppc
self.status_ = 0

self.ppp_title = pn.pane.Markdown(
Expand Down Expand Up @@ -302,7 +300,6 @@ def run_ppp(
tb_ppc,
weights,
self.single_exptime,
self.max_nppc,
1.38,
quiet,
clustering_algorithm,
Expand Down

0 comments on commit f13ff7c

Please sign in to comment.