|
229 | 229 | "metadata": {}, |
230 | 230 | "outputs": [], |
231 | 231 | "source": [ |
232 | | - "obsloctap_url = \"https://usdf-rsp-dev.slac.stanford.edu/obsloctap\"" |
| 232 | + "obsloctap_url = \"https://usdf-rsp.slac.stanford.edu/obsloctap\"" |
233 | 233 | ] |
234 | 234 | }, |
235 | 235 | { |
|
258 | 258 | "id": "16", |
259 | 259 | "metadata": {}, |
260 | 260 | "source": [ |
261 | | - "#### 3.3.1. Query the service header information\n" |
| 261 | + "#### 3.2.1. Query the service header information" |
262 | 262 | ] |
263 | 263 | }, |
264 | 264 | { |
|
283 | 283 | "id": "18", |
284 | 284 | "metadata": {}, |
285 | 285 | "source": [ |
286 | | - "## 3.3 Retrieve the Future Schedule \n", |
| 286 | + "### 3.3 Retrieve the Future Schedule \n", |
287 | 287 | "\n", |
288 | 288 | "Query the Rubin Schedule Service to get the upcoming forecast for up to 24 hours in advance\n", |
289 | 289 | "\n", |
|
373 | 373 | "id": "27", |
374 | 374 | "metadata": {}, |
375 | 375 | "source": [ |
376 | | - "### 3.3.3 Request only the next 2 hours or predicted schedule\n", |
| 376 | + "### 3.3.2 Request only the next 2 hours or predicted schedule\n", |
377 | 377 | "\n", |
378 | | - "Define a parameter to only retrieve the next X upcoming hours of schedule" |
| 378 | + "Define a parameter to retrieve only the next 2 hours of predicted schedule" |
379 | 379 | ] |
380 | 380 | }, |
381 | 381 | { |
|
385 | 385 | "metadata": {}, |
386 | 386 | "outputs": [], |
387 | 387 | "source": [ |
388 | | - "params = {\"time\": \"5\"}\n", |
| 388 | + "params = {\"time\": \"2\"}\n", |
389 | 389 | "response = requests.get(schedule_url, params=params)\n", |
390 | | - "assert (\n", |
391 | | - " response.url == \"https://usdf-rsp-dev.slac.stanford.edu/obsloctap/schedule?time=5\"\n", |
392 | | - ")\n", |
| 390 | + "print(response.url)\n", |
| 391 | + "assert response.url == \"https://usdf-rsp.slac.stanford.edu/obsloctap/schedule?time=2\"\n", |
393 | 392 | "assert response.status_code == 200, f\"request failed with status {response.status_code}\"" |
394 | 393 | ] |
395 | 394 | }, |
|
448 | 447 | "outputs": [], |
449 | 448 | "source": [ |
450 | 449 | "next_visits_from_date = response.json()\n", |
451 | | - "print(\n", |
452 | | - " f\"There are/were {len(next_visits_from_date)} visits \\\n", |
| 450 | + "print(f\"There are/were {len(next_visits_from_date)} visits \\\n", |
453 | 451 | "scheduled in the {params[\"time\"]} hour(s) from {params['start']}.\"\n", |
454 | 452 | ")" |
455 | 453 | ] |
456 | 454 | }, |
457 | 455 | { |
458 | | - "cell_type": "code", |
459 | | - "execution_count": null, |
460 | | - "id": "34", |
461 | | - "metadata": {}, |
462 | | - "outputs": [], |
463 | | - "source": [ |
464 | | - "past_time = (Time(\"2025-10-28 22:00:00\", format=\"iso\", scale=\"utc\")).mjd\n", |
465 | | - "print(past_time)" |
466 | | - ] |
467 | | - }, |
468 | | - { |
469 | | - "cell_type": "code", |
470 | | - "execution_count": null, |
471 | | - "id": "35", |
| 456 | + "cell_type": "markdown", |
| 457 | + "id": "17eece88-1567-4046-b8de-d78e26bb7506", |
472 | 458 | "metadata": {}, |
473 | | - "outputs": [], |
474 | 459 | "source": [ |
475 | | - "params = {\"time\": \"24\", \"start\": past_time}" |
| 460 | + "MJD date formats can also be used" |
476 | 461 | ] |
477 | 462 | }, |
478 | 463 | { |
|
482 | 467 | "metadata": {}, |
483 | 468 | "outputs": [], |
484 | 469 | "source": [ |
| 470 | + "past_time = (Time(\"2025-11-09 22:00:00\", format=\"iso\", scale=\"utc\")).mjd\n", |
| 471 | + "params = {\"time\": \"24\", \"start\": past_time}\n", |
485 | 472 | "response = requests.get(schedule_url, params=params)\n", |
486 | 473 | "assert response.status_code == 200, f\"request failed with status {response.status_code}\"\n", |
487 | 474 | "print(response.url)" |
|
544 | 531 | "metadata": {}, |
545 | 532 | "outputs": [], |
546 | 533 | "source": [ |
547 | | - "response = requests.get(schedule_url)\n", |
| 534 | + "time = (Time(\"2025-11-27 22:00:00\", format=\"iso\", scale=\"utc\")).mjd\n", |
| 535 | + "params = {\"time\": \"24\", \"start\": past_time}\n", |
| 536 | + "response = requests.get(schedule_url, params=params)\n", |
548 | 537 | "df = pd.DataFrame(response.json())\n", |
549 | | - "print(f\"There are {len(df)} visits scheduled in the next 24 hours\")" |
| 538 | + "print(f\"There are {len(df)} visits scheduled in the 24 hour time period\")" |
550 | 539 | ] |
551 | 540 | }, |
552 | 541 | { |
|
573 | 562 | " diff = abs(t_planning[i] - t_planning[i + 1]) * 60 * 60 * 24\n", |
574 | 563 | " if np.isnan(diff):\n", |
575 | 564 | " continue\n", |
576 | | - " obs_visit_gap.append(diff)\n", |
577 | | - "\n", |
578 | | - "print(f\"Number of differences: {len(obs_visit_gap)}\")" |
| 565 | + " obs_visit_gap.append(diff)" |
579 | 566 | ] |
580 | 567 | }, |
581 | 568 | { |
|
611 | 598 | " title=\"Histogram of successive visit gaps for scheduled observations\",\n", |
612 | 599 | " xlabel=\"Gap (seconds)\",\n", |
613 | 600 | " ylabel=\"Count\",\n", |
614 | | - " width=1000,\n", |
615 | | - " height=500,\n", |
| 601 | + " width=800,\n", |
| 602 | + " height=400,\n", |
616 | 603 | " line_color=\"steelblue\",\n", |
617 | 604 | " fill_color=\"lightblue\",\n", |
618 | 605 | " line_width=1,\n", |
|
0 commit comments