Skip to content

Commit bc2b4ca

Browse files
committed
paths
1 parent fc0232b commit bc2b4ca

File tree

1 file changed

+50
-31
lines changed

1 file changed

+50
-31
lines changed

prenight/run_sim.ipynb

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"id": "1a3d4bff-443a-4cb9-9342-09f059bed6df",
2020
"metadata": {},
2121
"source": [
22-
"# Run simulation for {params.day_obs} "
22+
"# Run simulation for {{ params.day_obs }} for {{ params.sim_nights }} nights."
2323
]
2424
},
2525
{
@@ -123,7 +123,8 @@
123123
"if ts_config_scheduler_root is None:\n",
124124
" # Just make a new clone for ts_config_scheduler in a temporary directory\n",
125125
" import tempfile\n",
126-
" ts_config_scheduler_root = tempfile.mkdtemp()\n",
126+
" tmpdir = tempfile.mkdtemp()\n",
127+
" ts_config_scheduler_root = os.path.join(tmpdir, \"ts_config_scheduler\")\n",
127128
" ts_config_is_temp = True\n",
128129
" do_git_stuff = True\n",
129130
"else:\n",
@@ -190,6 +191,17 @@
190191
"#%load_ext memory_profiler"
191192
]
192193
},
194+
{
195+
"cell_type": "code",
196+
"execution_count": null,
197+
"id": "52639da3-457d-4bc2-8dd8-f0a06b59f526",
198+
"metadata": {},
199+
"outputs": [],
200+
"source": [
201+
"day_obs = int(day_obs)\n",
202+
"sim_nights = int(sim_nights)"
203+
]
204+
},
193205
{
194206
"cell_type": "code",
195207
"execution_count": null,
@@ -273,32 +285,32 @@
273285
"metadata": {},
274286
"outputs": [],
275287
"source": [
276-
"# Some configuration information ... I'm not sure whether we can/will use this at present.\n",
288+
"# # Some configuration information ... I'm not sure whether we can/will use this at present.\n",
277289
"\n",
278-
"# run branch\n",
279-
"q = endpoints['obsenv'].select_top_n(\"lsst.obsenv.run_branch\", ['branch_name'], 1, time_cut=sunset)\n",
280-
"q2 = endpoints['obsenv'].select_time_series(\"lsst.obsenv.run_branch\", [\"branch_name\"], sunset, sunrise)\n",
281-
"runbranch = pd.concat([q, q2])\n",
282-
"display(runbranch)\n",
283-
"current_runbranch = runbranch.branch_name.iloc[-1]\n",
284-
"print(f\"Current run branch {current_runbranch}\")\n",
285-
"# configuration information\n",
286-
"q = endpoints['efd'].select_top_n('lsst.sal.Scheduler.logevent_configurationApplied', [\"configurations\", \"salIndex\", \"private_origin\", \"url\", \"version\"], 1, time_cut=sunset, index=1)\n",
287-
"q2 = endpoints['efd'].select_time_series('lsst.sal.Scheduler.logevent_configurationApplied', [\"configurations\", \"salIndex\", \"private_origin\", \"url\", \"version\"], sunset, sunrise, index=1)\n",
288-
"q = pd.concat([q, q2])\n",
289-
"def strip_repo(x: pd.Series):\n",
290-
" return x.url.split(\"/\")[-3]\n",
291-
"def strip_version(x: pd.Series):\n",
292-
" return x.version.replace(\"heads/\", \"\")\n",
293-
"def strip_yaml(x: pd.Series):\n",
294-
" return x.configurations.split(\",\")[-1]\n",
295-
"config_repo = q.apply(strip_repo, axis=1)\n",
296-
"config_version = q.apply(strip_version, axis=1)\n",
297-
"config_yaml = q.apply(strip_yaml, axis=1)\n",
298-
"configs = pd.DataFrame([config_repo, config_version, config_yaml], columns=q.index, index=['config_repo', 'config_commit', 'config_yaml']).T\n",
299-
"current_commit = config_version.iloc[0]\n",
300-
"display(configs)\n",
301-
"print(f\"Current commit {current_commit}\")"
290+
"# # run branch\n",
291+
"# q = endpoints['obsenv'].select_top_n(\"lsst.obsenv.run_branch\", ['branch_name'], 1, time_cut=sunset)\n",
292+
"# q2 = endpoints['obsenv'].select_time_series(\"lsst.obsenv.run_branch\", [\"branch_name\"], sunset, sunrise)\n",
293+
"# runbranch = pd.concat([q, q2])\n",
294+
"# display(runbranch)\n",
295+
"# current_runbranch = runbranch.branch_name.iloc[-1]\n",
296+
"# print(f\"Current run branch {current_runbranch}\")\n",
297+
"# # configuration information\n",
298+
"# q = endpoints['efd'].select_top_n('lsst.sal.Scheduler.logevent_configurationApplied', [\"configurations\", \"salIndex\", \"private_origin\", \"url\", \"version\"], 1, time_cut=sunset, index=1)\n",
299+
"# q2 = endpoints['efd'].select_time_series('lsst.sal.Scheduler.logevent_configurationApplied', [\"configurations\", \"salIndex\", \"private_origin\", \"url\", \"version\"], sunset, sunrise, index=1)\n",
300+
"# q = pd.concat([q, q2])\n",
301+
"# def strip_repo(x: pd.Series):\n",
302+
"# return x.url.split(\"/\")[-3]\n",
303+
"# def strip_version(x: pd.Series):\n",
304+
"# return x.version.replace(\"heads/\", \"\")\n",
305+
"# def strip_yaml(x: pd.Series):\n",
306+
"# return x.configurations.split(\",\")[-1]\n",
307+
"# config_repo = q.apply(strip_repo, axis=1)\n",
308+
"# config_version = q.apply(strip_version, axis=1)\n",
309+
"# config_yaml = q.apply(strip_yaml, axis=1)\n",
310+
"# configs = pd.DataFrame([config_repo, config_version, config_yaml], columns=q.index, index=['config_repo', 'config_commit', 'config_yaml']).T\n",
311+
"# current_commit = config_version.iloc[0]\n",
312+
"# display(configs)\n",
313+
"# print(f\"Current commit {current_commit}\")"
302314
]
303315
},
304316
{
@@ -383,9 +395,13 @@
383395
" except FileNotFoundError:\n",
384396
" toos = None\n",
385397
"\n",
386-
"print(f\"Retrieved {len(toos)} ToOs\")\n",
387-
"# Wrap up ToOs for sim target server - only last currently relevant\n",
388-
"too_server = SimTargetooServer(toos)"
398+
"if toos is not None:\n",
399+
" print(f\"Retrieved {len(toos)} ToOs\")\n",
400+
" # Wrap up ToOs for sim target server \n",
401+
" too_server = SimTargetooServer(toos)\n",
402+
"else:\n",
403+
" print(\"No ToO information\")\n",
404+
" too_server = None"
389405
]
390406
},
391407
{
@@ -456,7 +472,7 @@
456472
"source": [
457473
"if ts_config_is_temp:\n",
458474
" import shutil\n",
459-
" shutil.rmtree(ts_config_scheduler_root)"
475+
" shutil.rmtree(tmpdir)"
460476
]
461477
},
462478
{
@@ -1008,6 +1024,9 @@
10081024
" if vnvis['all'].metric_values is not None:\n",
10091025
" mval = vnvis['all'].metric_values\n",
10101026
" vmax = np.percentile(mval.compressed(), 95)\n",
1027+
" alpha = np.where(np.isnan(background), 0, background)\n",
1028+
" alpha = np.where(alpha> 0.5, 0.5, alpha)\n",
1029+
" alpha = np.where(mval.filled(0) > 0, 1, alpha)\n",
10111030
" plot.hp_moll(mval.filled(0), alpha=alpha, vmin=0, vmax=vmax, label='Consdb night')"
10121031
]
10131032
},

0 commit comments

Comments
 (0)