Skip to content

Commit 90506f1

Browse files
committed
Update tokenfile everywhere; add night already started option for run_sim
1 parent bc2b4ca commit 90506f1

File tree

6 files changed

+220
-147
lines changed

6 files changed

+220
-147
lines changed

nightly/ConsDB_visits_metadata.ipynb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,29 @@
125125
"metadata": {},
126126
"outputs": [],
127127
"source": [
128-
"if 'usdf' in os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\"):\n",
128+
"# Where is the notebook running? (RSPs are 'special')\n",
129+
"current_location = os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\")\n",
130+
"\n",
131+
"# RUBIN_SIM_DATA_DIR at usdf\n",
132+
"if 'usdf' in current_location:\n",
129133
" os.environ[\"RUBIN_SIM_DATA_DIR\"] = \"/sdf/data/rubin/shared/rubin_sim_data\"\n",
130134
"\n",
131135
"# TOKEN CONFIGURATION\n",
132-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is None:\n",
133-
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
134-
" site = 'usdf'\n",
135-
"else:\n",
136+
"if current_location != \"\":\n",
136137
" # You are on an rsp.\n",
138+
" # You should use the default RSP values, whether summit/base/USDF.\n",
137139
" tokenfile = None\n",
138140
" site = None\n",
141+
"# If you are outside of an RSP? - just use USDF and your own USDF-RSP token\n",
142+
"# See https://rsp.lsst.io/guides/auth/creating-user-tokens.html\n",
143+
"else:\n",
144+
" # Substitute the location of your own tokenfile\n",
145+
" tokenfile = os.getenv(\"ACCESS_TOKEN_FILE\", \"\")\n",
146+
" site = os.getenv(\"DATA_SITE\", \"\")\n",
147+
" if tokenfile == \"\":\n",
148+
" # A very reasonable backup.\n",
149+
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
150+
" site = 'usdf'\n",
139151
"\n",
140152
"endpoints = connections.get_clients(tokenfile, site)\n",
141153
"consdb = endpoints['consdb']"

nightly/EvaluateScriptQueue.ipynb

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@
2626
"# EFD Scripts + Logs "
2727
]
2828
},
29-
{
30-
"cell_type": "code",
31-
"execution_count": null,
32-
"id": "54727427-2a2f-4501-9687-3bf819d6da99",
33-
"metadata": {},
34-
"outputs": [],
35-
"source": [
36-
"import os\n",
37-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is not None:\n",
38-
" print(\"updating rubin_nights\")\n",
39-
" !pip install --user --upgrade git+https://github.com/lsst-sims/rubin_nights.git --no-deps > /dev/null 2>&1"
40-
]
41-
},
4229
{
4330
"cell_type": "code",
4431
"execution_count": null,
@@ -61,12 +48,29 @@
6148
"import logging\n",
6249
"logging.getLogger('rubin_nights').setLevel(logging.INFO)\n",
6350
"\n",
64-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is None:\n",
65-
" tokenfile = '/Users/lynnej/.lsst/usdf_rsp'\n",
66-
" site = 'usdf'\n",
67-
"else:\n",
51+
"# Where is the notebook running? (RSPs are 'special')\n",
52+
"current_location = os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\")\n",
53+
"\n",
54+
"# RUBIN_SIM_DATA_DIR at usdf\n",
55+
"if 'usdf' in current_location:\n",
56+
" os.environ[\"RUBIN_SIM_DATA_DIR\"] = \"/sdf/data/rubin/shared/rubin_sim_data\"\n",
57+
"\n",
58+
"# TOKEN CONFIGURATION\n",
59+
"if current_location != \"\":\n",
60+
" # You are on an rsp.\n",
61+
" # You should use the default RSP values, whether summit/base/USDF.\n",
6862
" tokenfile = None\n",
69-
" site = None"
63+
" site = None\n",
64+
"# If you are outside of an RSP? - just use USDF and your own USDF-RSP token\n",
65+
"# See https://rsp.lsst.io/guides/auth/creating-user-tokens.html\n",
66+
"else:\n",
67+
" # Substitute the location of your own tokenfile\n",
68+
" tokenfile = os.getenv(\"ACCESS_TOKEN_FILE\", \"\")\n",
69+
" site = os.getenv(\"DATA_SITE\", \"\")\n",
70+
" if tokenfile == \"\":\n",
71+
" # A very reasonable backup.\n",
72+
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
73+
" site = 'usdf'"
7074
]
7175
},
7276
{

nightly/FBS_Targets.ipynb

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"outputs": [],
99
"source": [
1010
"# This cell is only for setting example parameter defaults - gets replaced by sidecar.\n",
11-
"day_obs = \"20251120\"\n",
11+
"day_obs = \"20251122\"\n",
1212
"#day_obs = \"today\"\n",
1313
"#telescope = \"AuxTel\" \n",
1414
"telescope = \"SimonyiTel\"\n",
@@ -99,17 +99,29 @@
9999
"import rubin_nights.dayobs_utils as rn_dayobs\n",
100100
"from rubin_nights.targets_and_visits import targets_and_visits, flag_potential_bad_visits\n",
101101
"\n",
102-
"if 'usdf' in os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\"):\n",
102+
"# Where is the notebook running? (RSPs are 'special')\n",
103+
"current_location = os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\")\n",
104+
"\n",
105+
"# RUBIN_SIM_DATA_DIR at usdf\n",
106+
"if 'usdf' in current_location:\n",
103107
" os.environ[\"RUBIN_SIM_DATA_DIR\"] = \"/sdf/data/rubin/shared/rubin_sim_data\"\n",
104108
"\n",
105109
"# TOKEN CONFIGURATION\n",
106-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is None:\n",
107-
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
108-
" site = 'usdf'\n",
109-
"else:\n",
110+
"if current_location != \"\":\n",
110111
" # You are on an rsp.\n",
112+
" # You should use the default RSP values, whether summit/base/USDF.\n",
111113
" tokenfile = None\n",
112114
" site = None\n",
115+
"# If you are outside of an RSP? - just use USDF and your own USDF-RSP token\n",
116+
"# See https://rsp.lsst.io/guides/auth/creating-user-tokens.html\n",
117+
"else:\n",
118+
" # Substitute the location of your own tokenfile\n",
119+
" tokenfile = os.getenv(\"ACCESS_TOKEN_FILE\", \"\")\n",
120+
" site = os.getenv(\"DATA_SITE\", \"\")\n",
121+
" if tokenfile == \"\":\n",
122+
" # A very reasonable backup.\n",
123+
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
124+
" site = 'usdf'\n",
113125
"\n",
114126
"minutes_to_days = 1./60/24\n",
115127
"seconds_to_days = 1./60/60/24\n",

nightly/FindPotentialBadVisits.ipynb

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"day_obs = 20250722\n",
10+
"day_obs = 20251115\n",
1111
"#day_obs = \"yesterday\"\n",
1212
"show_joined = False"
1313
]
@@ -38,30 +38,6 @@
3838
"---------"
3939
]
4040
},
41-
{
42-
"cell_type": "code",
43-
"execution_count": null,
44-
"id": "5715adab-58f4-442d-a73d-cb049ac0865c",
45-
"metadata": {},
46-
"outputs": [],
47-
"source": [
48-
"import os\n",
49-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is not None:\n",
50-
" print(\"updating rubin_nights\")\n",
51-
" !pip install --user --upgrade git+https://github.com/lsst-sims/rubin_nights.git --no-deps > /dev/null 2>&1"
52-
]
53-
},
54-
{
55-
"cell_type": "code",
56-
"execution_count": null,
57-
"id": "e078f2ff-9b8c-45eb-ac2a-50e46c518e9f",
58-
"metadata": {},
59-
"outputs": [],
60-
"source": [
61-
"import rubin_nights\n",
62-
"print('rubin_nights version', rubin_nights.__version__)"
63-
]
64-
},
6541
{
6642
"cell_type": "code",
6743
"execution_count": null,
@@ -101,12 +77,31 @@
10177
"metadata": {},
10278
"outputs": [],
10379
"source": [
104-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is None:\n",
105-
" tokenfile = '/Users/lynnej/.lsst/usdf_rsp'\n",
106-
" site = 'usdf'\n",
107-
"else:\n",
80+
"# Where is the notebook running? (RSPs are 'special')\n",
81+
"current_location = os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\")\n",
82+
"\n",
83+
"# RUBIN_SIM_DATA_DIR at usdf\n",
84+
"if 'usdf' in current_location:\n",
85+
" os.environ[\"RUBIN_SIM_DATA_DIR\"] = \"/sdf/data/rubin/shared/rubin_sim_data\"\n",
86+
"\n",
87+
"# TOKEN CONFIGURATION\n",
88+
"if current_location != \"\":\n",
89+
" # You are on an rsp.\n",
90+
" # You should use the default RSP values, whether summit/base/USDF.\n",
10891
" tokenfile = None\n",
10992
" site = None\n",
93+
"# If you are outside of an RSP? - just use USDF and your own USDF-RSP token\n",
94+
"# See https://rsp.lsst.io/guides/auth/creating-user-tokens.html\n",
95+
"else:\n",
96+
" # Substitute the location of your own tokenfile\n",
97+
" tokenfile = os.getenv(\"ACCESS_TOKEN_FILE\", \"\")\n",
98+
" site = os.getenv(\"DATA_SITE\", \"\")\n",
99+
" if tokenfile == \"\":\n",
100+
" # A very reasonable backup.\n",
101+
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
102+
" site = 'usdf'\n",
103+
"\n",
104+
"\n",
110105
"endpoints = connections.get_clients(tokenfile=tokenfile, site=site)"
111106
]
112107
},
@@ -143,8 +138,18 @@
143138
"if vt is None:\n",
144139
" vt = []\n",
145140
"print(f\"Found {len(vt)} targets->visits.\")\n",
141+
"\n",
146142
"if len(visits) > 0:\n",
147-
" print(f\"Visit metadata included {visits.scheduler_note.unique()}, {visits.target_name.unique()}\")"
143+
" def split_regions(x):\n",
144+
" regions = set()\n",
145+
" for k in x: #.target_name:\n",
146+
" regions = regions.union(set([kk.replace(' ', '') for kk in k.split(',')]))\n",
147+
" regions = list(regions)\n",
148+
" regions.sort()\n",
149+
" return regions\n",
150+
" print(\"Regions observed\", split_regions(visits.target_name.unique()))\n",
151+
" print(\"Science programs\", visits.science_program.unique())\n",
152+
" print(\"Observation Reasons / Surveys\", np.sort(visits.observation_reason.unique()))"
148153
]
149154
},
150155
{

nightly/GapLogs.ipynb

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"day_obs = 20251109\n",
10+
"day_obs = 20251123\n",
1111
"time_gap = 5"
1212
]
1313
},
@@ -19,19 +19,6 @@
1919
"# SQMiner Logs for LSSTCam (consdb) visit gaps {{ params.day_obs }} (gap > {{ params.time_gap }})"
2020
]
2121
},
22-
{
23-
"cell_type": "code",
24-
"execution_count": null,
25-
"id": "776c9fa6-2708-47a9-ad8e-8b91b6720c1c",
26-
"metadata": {},
27-
"outputs": [],
28-
"source": [
29-
"import os\n",
30-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is not None:\n",
31-
" print(\"updating rubin_nights\")\n",
32-
" !pip install --user --upgrade git+https://github.com/lsst-sims/rubin_nights.git --no-deps > /dev/null 2>&1"
33-
]
34-
},
3522
{
3623
"cell_type": "code",
3724
"execution_count": null,
@@ -56,17 +43,29 @@
5643
"\n",
5744
"tz_utc = ZoneInfo(\"UTC\")\n",
5845
"\n",
46+
"# Where is the notebook running? (RSPs are 'special')\n",
47+
"current_location = os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\")\n",
5948
"\n",
60-
"if 'usdf' in os.getenv(\"EXTERNAL_INSTANCE_URL\", \"\"):\n",
49+
"# RUBIN_SIM_DATA_DIR at usdf\n",
50+
"if 'usdf' in current_location:\n",
6151
" os.environ[\"RUBIN_SIM_DATA_DIR\"] = \"/sdf/data/rubin/shared/rubin_sim_data\"\n",
6252
"\n",
63-
"\n",
64-
"if os.getenv(\"EXTERNAL_INSTANCE_URL\") is None:\n",
65-
" tokenfile = '/Users/lynnej/.lsst/usdf_rsp'\n",
66-
" site = 'usdf'\n",
67-
"else:\n",
53+
"# TOKEN CONFIGURATION\n",
54+
"if current_location != \"\":\n",
55+
" # You are on an rsp.\n",
56+
" # You should use the default RSP values, whether summit/base/USDF.\n",
6857
" tokenfile = None\n",
69-
" site = None"
58+
" site = None\n",
59+
"# If you are outside of an RSP? - just use USDF and your own USDF-RSP token\n",
60+
"# See https://rsp.lsst.io/guides/auth/creating-user-tokens.html\n",
61+
"else:\n",
62+
" # Substitute the location of your own tokenfile\n",
63+
" tokenfile = os.getenv(\"ACCESS_TOKEN_FILE\", \"\")\n",
64+
" site = os.getenv(\"DATA_SITE\", \"\")\n",
65+
" if tokenfile == \"\":\n",
66+
" # A very reasonable backup.\n",
67+
" tokenfile = os.path.join(os.path.expanduser(\"~\"), \".lsst/usdf_rsp\")\n",
68+
" site = 'usdf'"
7069
]
7170
},
7271
{

0 commit comments

Comments
 (0)