Skip to content

Commit

Permalink
Merge pull request #298 from Subaru-PFS/u/wanqqq/para_long_extpime
Browse files Browse the repository at this point in the history
modify cost for running netflow
  • Loading branch information
monodera authored Aug 26, 2024
2 parents 6bf657b + 0ccdccc commit 45cfe1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 19 additions & 5 deletions src/pfs_target_uploader/utils/ppp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def PPPrunStart(
ppp_quiet = quiet

if weight_para is None:
weight_para = [2.0, 0.0, 0.0]
weight_para = [2.02, 0.01, 0.01]

is_exetime = (exetime is not None) and (exetime > 0)
is_nppc = (max_nppc is not None) and (max_nppc > 0)
Expand Down Expand Up @@ -519,7 +519,8 @@ def sam2netflow(sample):
int_ = 0
for tt in sample:
id_, ra, dec, tm = (tt["ob_code"], tt["ra"], tt["dec"], tt["exptime_PPP"])
targetL.append(nf.ScienceTarget(id_, ra, dec, tm, int_, "sci"))
#targetL.append(nf.ScienceTarget(id_, ra, dec, tm, int_, "sci"))
targetL.append(nf.ScienceTarget(id_, ra, dec, tm, tt["priority"], "sci"))
int_ += 1

return targetL
Expand All @@ -538,6 +539,7 @@ class of targets with costs

classdict = {}

"""
int_ = 0
for ii in sample:
classdict["sci_P" + str(int_)] = {
Expand All @@ -546,12 +548,24 @@ class of targets with costs
"calib": False,
}
int_ += 1
#"""

classdict["sci_P0"] = {"nonObservationCost": 100, "partialObservationCost": 200, "calib": False,}
classdict["sci_P1"] = {"nonObservationCost": 90, "partialObservationCost": 200, "calib": False,}
classdict["sci_P2"] = {"nonObservationCost": 80, "partialObservationCost": 200, "calib": False,}
classdict["sci_P3"] = {"nonObservationCost": 70, "partialObservationCost": 200, "calib": False,}
classdict["sci_P4"] = {"nonObservationCost": 60, "partialObservationCost": 200, "calib": False,}
classdict["sci_P5"] = {"nonObservationCost": 50, "partialObservationCost": 200, "calib": False,}
classdict["sci_P6"] = {"nonObservationCost": 40, "partialObservationCost": 200, "calib": False,}
classdict["sci_P7"] = {"nonObservationCost": 30, "partialObservationCost": 200, "calib": False,}
classdict["sci_P8"] = {"nonObservationCost": 20, "partialObservationCost": 200, "calib": False,}
classdict["sci_P9"] = {"nonObservationCost": 10, "partialObservationCost": 200, "calib": False,}

return classdict

def cobraMoveCost(dist):
"""optional: penalize assignments where the cobra has to move far out"""
return 0.0 * dist
return 0.1 * dist

def netflowRun_single(Tel, sample, otime="2024-05-20T08:00:00Z"):
"""run netflow (without iteration)
Expand Down Expand Up @@ -591,7 +605,7 @@ def netflowRun_single(Tel, sample, otime="2024-05-20T08:00:00Z"):
degenmoves=0,
heuristics=0.8,
mipfocus=0,
mipgap=1.0e-4,
mipgap=5.0e-2,
LogToConsole=0,
)

Expand Down Expand Up @@ -1198,7 +1212,7 @@ def ppp_plotFig(RESmode, cR, sub, obj_allo, uS):
for count in (np.arange(0, len(obj_allo), 1) + 1)
]

obj_allo1 = obj_allo1.group_by("ppc_code")
#obj_allo1 = obj_allo1.group_by("ppc_code")
obj_allo1.rename_column("tel_fiber_usage_frac", "Fiber usage fraction (%)")
obj_allo2 = Table.to_pandas(obj_allo1)
uS_ = Table.to_pandas(uS)
Expand Down
2 changes: 1 addition & 1 deletion src/pfs_target_uploader/widgets/PppResultWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def run_ppp(
quiet=True,
):
if weights is None:
weights = [2.0, 0.0, 0.0]
weights = [2.02, 0.01, 0.01]

self.df_input = df
self.df_input["single_exptime"] = single_exptime
Expand Down

0 comments on commit 45cfe1e

Please sign in to comment.