sparclclient 1.2.2b8__py2.py3-none-any.whl → 1.2.2b10__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2177 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "__author__ = 'Alice Jacques <alice.jacques@noirlab.edu>'\n",
10
- "__version__ = '20230519' # yyyymmdd; \n",
11
- "__datasets__ = ['sdss_dr16','boss_dr16','desi_edr']"
12
- ]
13
- },
14
- {
15
- "cell_type": "markdown",
16
- "metadata": {},
17
- "source": [
18
- "# Testing all SPARCL client methods"
19
- ]
20
- },
21
- {
22
- "cell_type": "markdown",
23
- "metadata": {},
24
- "source": [
25
- "### Table of contents\n",
26
- "* [<tt>get_all_fields(dataset_list=None)</tt>](#get_all_fields)\n",
27
- " * [<tt>dataset_list</tt>](#get_all_fields_dataset_list)\n",
28
- "* [<tt>get_default_fields(dataset_list=None)</tt>](#get_default_fields)\n",
29
- " * [<tt>dataset_list</tt>](#get_default_fields_dataset_list)\n",
30
- "* [<tt>get_available_fields(dataset_list=None)</tt>](#get_available_fields)\n",
31
- " * [<tt>dataset_list</tt>](#get_available_fields_dataset_list)\n",
32
- "* [<tt>find(outfields=None, constraints={}, dataset_list=None, limit=500, sort=None)</tt>](#find)\n",
33
- " * [<tt>limit</tt>](#find_limit)\n",
34
- " * [<tt>constraints</tt>](#find_constraints)\n",
35
- " * [<tt>outfields</tt>](#find_outfields)\n",
36
- " * [<tt>sort</tt>](#find_sort)\n",
37
- "* [<tt>retrieve(uuid_list, include='DEFAULT', dataset_list=None, limit=500)</tt>](#retrieve)\n",
38
- " * [<tt>limit</tt>](#retrieve_limit)\n",
39
- " * [<tt>dataset_list</tt>](#retrieve_dataset_list)\n",
40
- " * [<tt>include</tt>](#retrieve_include)\n",
41
- "* [<tt>retrieve_by_specid(specid_list, include='DEFAULT', dataset_list=None, limit=500)</tt>](#retrieve_by_specid)\n",
42
- " * [<tt>limit</tt>](#retrieve_by_specid_limit)\n",
43
- " * [<tt>dataset_list</tt>](#retrieve_by_specid_dataset_list)\n",
44
- " * [<tt>include</tt>](#retrieve_by_specid_include)\n",
45
- "* [<tt>missing(uuid_list, dataset_list=None, countOnly=False)</tt>](#missing)\n",
46
- " * [<tt>uuid_list</tt>](#missing_uuid_list)\n",
47
- " * [<tt>dataset_list</tt>](#missing_dataset_list)\n",
48
- " * [<tt>countOnly</tt>](#missing_countOnly)\n",
49
- "* [<tt>missing_specids(specid_list, dataset_list=None, countOnly=False)</tt>](#missing_specids)\n",
50
- " * [<tt>specid_list</tt>](#missing_specids_specid_list)\n",
51
- " * [<tt>dataset_list</tt>](#missing_specids_dataset_list)\n",
52
- " * [<tt>countOnly</tt>](#missing_specids_countOnly)"
53
- ]
54
- },
55
- {
56
- "cell_type": "code",
57
- "execution_count": 2,
58
- "metadata": {},
59
- "outputs": [],
60
- "source": [
61
- "#!pip install sparclclient==1.2.0b4.dev1"
62
- ]
63
- },
64
- {
65
- "cell_type": "code",
66
- "execution_count": 3,
67
- "metadata": {},
68
- "outputs": [
69
- {
70
- "ename": "ModuleNotFoundError",
71
- "evalue": "No module named 'sparcl'",
72
- "output_type": "error",
73
- "traceback": [
74
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
75
- "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
76
- "Cell \u001b[0;32mIn[3], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# SPARCL imports\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msparcl\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mclient\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m SparclClient\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# 3rd party imports\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtime\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m time\n",
77
- "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sparcl'"
78
- ]
79
- }
80
- ],
81
- "source": [
82
- "# SPARCL imports\n",
83
- "from sparcl.client import SparclClient\n",
84
- "\n",
85
- "# 3rd party imports\n",
86
- "from time import time\n",
87
- "\n",
88
- "# Data Lab imports\n",
89
- "#! from dl import queryClient as qc\n",
90
- "#! from dl import authClient as ac\n",
91
- "#! from getpass import getpass"
92
- ]
93
- },
94
- {
95
- "cell_type": "code",
96
- "execution_count": null,
97
- "metadata": {},
98
- "outputs": [],
99
- "source": [
100
- "client = SparclClient(url='https://sparc1.datalab.noirlab.edu')\n",
101
- "client"
102
- ]
103
- },
104
- {
105
- "cell_type": "markdown",
106
- "metadata": {},
107
- "source": [
108
- "<a class=\"anchor\" id=\"get_all_fields\"></a>\n",
109
- "## client.get_all_fields()"
110
- ]
111
- },
112
- {
113
- "cell_type": "code",
114
- "execution_count": null,
115
- "metadata": {},
116
- "outputs": [],
117
- "source": [
118
- "client.get_all_fields?"
119
- ]
120
- },
121
- {
122
- "cell_type": "code",
123
- "execution_count": null,
124
- "metadata": {},
125
- "outputs": [],
126
- "source": [
127
- "# Get all fields common to all datasets\n",
128
- "print(client.get_all_fields())"
129
- ]
130
- },
131
- {
132
- "cell_type": "markdown",
133
- "metadata": {},
134
- "source": [
135
- "<a class=\"anchor\" id=\"get_all_fields_dataset_list\"></a>\n",
136
- "### parameter to test: dataset_list"
137
- ]
138
- },
139
- {
140
- "cell_type": "code",
141
- "execution_count": null,
142
- "metadata": {},
143
- "outputs": [],
144
- "source": [
145
- "# Get all fields in SDSS-DR16\n",
146
- "print(client.get_all_fields(dataset_list=['SDSS-DR16']))"
147
- ]
148
- },
149
- {
150
- "cell_type": "code",
151
- "execution_count": null,
152
- "metadata": {},
153
- "outputs": [],
154
- "source": [
155
- "# Get all fields in BOSS-DR16\n",
156
- "print(client.get_all_fields(dataset_list=['BOSS-DR16']))"
157
- ]
158
- },
159
- {
160
- "cell_type": "code",
161
- "execution_count": null,
162
- "metadata": {},
163
- "outputs": [],
164
- "source": [
165
- "# Get all fields in DESI-EDR\n",
166
- "print(client.get_all_fields(dataset_list=['DESI-EDR']))"
167
- ]
168
- },
169
- {
170
- "cell_type": "code",
171
- "execution_count": null,
172
- "metadata": {},
173
- "outputs": [],
174
- "source": [
175
- "# Get all fields common to both SDSS-DR16 and DESI-EDR\n",
176
- "print(client.get_all_fields(dataset_list=['SDSS-DR16','DESI-EDR']))"
177
- ]
178
- },
179
- {
180
- "cell_type": "markdown",
181
- "metadata": {},
182
- "source": [
183
- "<a class=\"anchor\" id=\"get_default_fields\"></a>\n",
184
- "## client.get_default_fields()"
185
- ]
186
- },
187
- {
188
- "cell_type": "code",
189
- "execution_count": null,
190
- "metadata": {},
191
- "outputs": [],
192
- "source": [
193
- "client.get_default_fields?"
194
- ]
195
- },
196
- {
197
- "cell_type": "code",
198
- "execution_count": null,
199
- "metadata": {},
200
- "outputs": [],
201
- "source": [
202
- "# Get default fields common to all datasets\n",
203
- "print(client.get_default_fields())"
204
- ]
205
- },
206
- {
207
- "cell_type": "markdown",
208
- "metadata": {},
209
- "source": [
210
- "<a class=\"anchor\" id=\"get_default_fields_dataset_list\"></a>\n",
211
- "### parameter to test: dataset_list"
212
- ]
213
- },
214
- {
215
- "cell_type": "code",
216
- "execution_count": null,
217
- "metadata": {},
218
- "outputs": [],
219
- "source": [
220
- "# Get default fields in SDSS-DR16\n",
221
- "print(client.get_default_fields(dataset_list=['SDSS-DR16']))"
222
- ]
223
- },
224
- {
225
- "cell_type": "code",
226
- "execution_count": null,
227
- "metadata": {},
228
- "outputs": [],
229
- "source": [
230
- "# Get default fields in BOSS-DR16\n",
231
- "print(client.get_default_fields(dataset_list=['BOSS-DR16']))"
232
- ]
233
- },
234
- {
235
- "cell_type": "code",
236
- "execution_count": null,
237
- "metadata": {},
238
- "outputs": [],
239
- "source": [
240
- "# Get default fields in DESI-EDR\n",
241
- "print(client.get_default_fields(dataset_list=['DESI-EDR']))"
242
- ]
243
- },
244
- {
245
- "cell_type": "code",
246
- "execution_count": null,
247
- "metadata": {},
248
- "outputs": [],
249
- "source": [
250
- "# Get default fields common to both SDSS-DR16 and DESI-EDR\n",
251
- "print(client.get_default_fields(dataset_list=['SDSS-DR16','DESI-EDR']))"
252
- ]
253
- },
254
- {
255
- "cell_type": "markdown",
256
- "metadata": {},
257
- "source": [
258
- "<a class=\"anchor\" id=\"get_available_fields\"></a>\n",
259
- "## client.get_available_fields()"
260
- ]
261
- },
262
- {
263
- "cell_type": "code",
264
- "execution_count": null,
265
- "metadata": {},
266
- "outputs": [],
267
- "source": [
268
- "client.get_available_fields?"
269
- ]
270
- },
271
- {
272
- "cell_type": "code",
273
- "execution_count": null,
274
- "metadata": {},
275
- "outputs": [],
276
- "source": [
277
- "# Get available fields common to all datasets\n",
278
- "print(client.get_available_fields())"
279
- ]
280
- },
281
- {
282
- "cell_type": "markdown",
283
- "metadata": {},
284
- "source": [
285
- "<a class=\"anchor\" id=\"get_available_fields_dataset_list\"></a>\n",
286
- "### parameter to test: dataset_list"
287
- ]
288
- },
289
- {
290
- "cell_type": "code",
291
- "execution_count": null,
292
- "metadata": {},
293
- "outputs": [],
294
- "source": [
295
- "# Get available fields in SDSS-DR16\n",
296
- "print(client.get_available_fields(dataset_list=['SDSS-DR16']))"
297
- ]
298
- },
299
- {
300
- "cell_type": "code",
301
- "execution_count": null,
302
- "metadata": {},
303
- "outputs": [],
304
- "source": [
305
- "# Get available fields in BOSS-DR16\n",
306
- "print(client.get_available_fields(dataset_list=['BOSS-DR16']))"
307
- ]
308
- },
309
- {
310
- "cell_type": "code",
311
- "execution_count": null,
312
- "metadata": {},
313
- "outputs": [],
314
- "source": [
315
- "# Get available fields in DESI-EDR\n",
316
- "print(client.get_available_fields(dataset_list=['DESI-EDR']))"
317
- ]
318
- },
319
- {
320
- "cell_type": "code",
321
- "execution_count": null,
322
- "metadata": {},
323
- "outputs": [],
324
- "source": [
325
- "# Get available fields common to both SDSS-DR16 and DESI-EDR\n",
326
- "print(client.get_available_fields(dataset_list=['SDSS-DR16', 'DESI-EDR']))"
327
- ]
328
- },
329
- {
330
- "cell_type": "markdown",
331
- "metadata": {},
332
- "source": [
333
- "<a class=\"anchor\" id=\"find\"></a>\n",
334
- "## client.find()"
335
- ]
336
- },
337
- {
338
- "cell_type": "code",
339
- "execution_count": null,
340
- "metadata": {},
341
- "outputs": [],
342
- "source": [
343
- "client.find?"
344
- ]
345
- },
346
- {
347
- "cell_type": "code",
348
- "execution_count": null,
349
- "metadata": {},
350
- "outputs": [],
351
- "source": [
352
- "outs = ['data_release','datasetgroup','dateobs_center','dec','exptime',\n",
353
- " 'sparcl_id','instrument','ra','redshift','redshift_err','redshift_warning',\n",
354
- " 'site','specid','specprimary','spectype','targetid','telescope',\n",
355
- " 'wavemax','wavemin']"
356
- ]
357
- },
358
- {
359
- "cell_type": "markdown",
360
- "metadata": {},
361
- "source": [
362
- "<a class=\"anchor\" id=\"find_limit\"></a>\n",
363
- "### parameter to test: limit"
364
- ]
365
- },
366
- {
367
- "cell_type": "code",
368
- "execution_count": null,
369
- "metadata": {},
370
- "outputs": [],
371
- "source": [
372
- "# does the default limit work?\n",
373
- "client.find()"
374
- ]
375
- },
376
- {
377
- "cell_type": "code",
378
- "execution_count": null,
379
- "metadata": {},
380
- "outputs": [],
381
- "source": [
382
- "# does setting a limit less than the default value work?\n",
383
- "client.find(limit=2)"
384
- ]
385
- },
386
- {
387
- "cell_type": "code",
388
- "execution_count": null,
389
- "metadata": {},
390
- "outputs": [],
391
- "source": [
392
- "# does setting a limit over the default value but under\n",
393
- "# the maximum value work?\n",
394
- "client.find(limit=800)"
395
- ]
396
- },
397
- {
398
- "cell_type": "code",
399
- "execution_count": null,
400
- "metadata": {},
401
- "outputs": [],
402
- "source": [
403
- "# does setting the limit to None work?\n",
404
- "client.find(limit=None)"
405
- ]
406
- },
407
- {
408
- "cell_type": "markdown",
409
- "metadata": {},
410
- "source": [
411
- "<a class=\"anchor\" id=\"find_constraints\"></a>\n",
412
- "### parameter to test: constraints"
413
- ]
414
- },
415
- {
416
- "cell_type": "code",
417
- "execution_count": null,
418
- "metadata": {},
419
- "outputs": [],
420
- "source": [
421
- "# No constraints passed\n",
422
- "\n",
423
- "found = client.find(outfields=outs, limit=10)\n",
424
- "print(f\"# records found: {len(found.records)}\")\n",
425
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
426
- "print(f\"First record: {found.records[0]}\")"
427
- ]
428
- },
429
- {
430
- "cell_type": "code",
431
- "execution_count": null,
432
- "metadata": {},
433
- "outputs": [],
434
- "source": [
435
- "# No outfields passed\n",
436
- "\n",
437
- "cons = {'data_release': ['SDSS-DR16'],\n",
438
- " 'dec': [4,29],\n",
439
- " 'exptime': [2000,12000],\n",
440
- " 'ra': [80,136],\n",
441
- " 'redshift': [2,5]}\n",
442
- "\n",
443
- "found = client.find(constraints=cons, limit=10)\n",
444
- "print(f\"# records found: {len(found.records)}\")\n",
445
- "print(f\"First record: {found.records[0]}\")"
446
- ]
447
- },
448
- {
449
- "cell_type": "code",
450
- "execution_count": null,
451
- "metadata": {},
452
- "outputs": [],
453
- "source": [
454
- "# Invalid constraint value: data_release\n",
455
- "\n",
456
- "cons = {'data_release': [{'poppy'}]}\n",
457
- "\n",
458
- "try:\n",
459
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
460
- "except Exception as e:\n",
461
- " print(e)"
462
- ]
463
- },
464
- {
465
- "cell_type": "code",
466
- "execution_count": null,
467
- "metadata": {},
468
- "outputs": [],
469
- "source": [
470
- "# Invalid constraint value: datasetgroup\n",
471
- "\n",
472
- "cons = {'datasetgroup': [{'daffodil'}]}\n",
473
- "\n",
474
- "try:\n",
475
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
476
- "except Exception as e:\n",
477
- " print(e)"
478
- ]
479
- },
480
- {
481
- "cell_type": "code",
482
- "execution_count": null,
483
- "metadata": {},
484
- "outputs": [],
485
- "source": [
486
- "# Invalid constraint value: dateobs_center\n",
487
- "\n",
488
- "cons = {'dateobs_center': ['2011-12-21 12:00']}\n",
489
- "\n",
490
- "try:\n",
491
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
492
- "except Exception as e:\n",
493
- " print(e)"
494
- ]
495
- },
496
- {
497
- "cell_type": "code",
498
- "execution_count": null,
499
- "metadata": {},
500
- "outputs": [],
501
- "source": [
502
- "# Invalid constraint value: dec\n",
503
- "\n",
504
- "cons = {'dec': [29]}\n",
505
- "\n",
506
- "try:\n",
507
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
508
- "except Exception as e:\n",
509
- " print(e)"
510
- ]
511
- },
512
- {
513
- "cell_type": "code",
514
- "execution_count": null,
515
- "metadata": {},
516
- "outputs": [],
517
- "source": [
518
- "# Invalid constraint value: exptime\n",
519
- "\n",
520
- "cons = {'exptime': [30]}\n",
521
- "\n",
522
- "try:\n",
523
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
524
- "except Exception as e:\n",
525
- " print(e)"
526
- ]
527
- },
528
- {
529
- "cell_type": "code",
530
- "execution_count": null,
531
- "metadata": {},
532
- "outputs": [],
533
- "source": [
534
- "# Invalid constraint value: instrument\n",
535
- "\n",
536
- "cons = {'instrument': [{'hyacinth'}]}\n",
537
- "\n",
538
- "try:\n",
539
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
540
- "except Exception as e:\n",
541
- " print(e)"
542
- ]
543
- },
544
- {
545
- "cell_type": "code",
546
- "execution_count": null,
547
- "metadata": {},
548
- "outputs": [],
549
- "source": [
550
- "# Invalid constraint value: ra\n",
551
- "\n",
552
- "cons = {'ra': [80]}\n",
553
- "\n",
554
- "try:\n",
555
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
556
- "except Exception as e:\n",
557
- " print(e)"
558
- ]
559
- },
560
- {
561
- "cell_type": "code",
562
- "execution_count": null,
563
- "metadata": {},
564
- "outputs": [],
565
- "source": [
566
- "# Invalid constraint value: redshift\n",
567
- "\n",
568
- "cons = {'redshift': [1]}\n",
569
- "\n",
570
- "try:\n",
571
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
572
- "except Exception as e:\n",
573
- " print(e)"
574
- ]
575
- },
576
- {
577
- "cell_type": "code",
578
- "execution_count": null,
579
- "metadata": {},
580
- "outputs": [],
581
- "source": [
582
- "# Invalid constraint value: redshift_err\n",
583
- "\n",
584
- "cons = {'redshift_err': [0.0001]}\n",
585
- "\n",
586
- "try:\n",
587
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
588
- "except Exception as e:\n",
589
- " print(e)"
590
- ]
591
- },
592
- {
593
- "cell_type": "code",
594
- "execution_count": null,
595
- "metadata": {},
596
- "outputs": [],
597
- "source": [
598
- "# Invalid constraint value: redshift_warning\n",
599
- "\n",
600
- "cons = {'redshift_warning': ['magnolia']}\n",
601
- "\n",
602
- "try:\n",
603
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
604
- "except Exception as e:\n",
605
- " print(e)"
606
- ]
607
- },
608
- {
609
- "cell_type": "code",
610
- "execution_count": null,
611
- "metadata": {},
612
- "outputs": [],
613
- "source": [
614
- "# Invalid constraint value: site\n",
615
- "\n",
616
- "cons = {'site': [{'lotus'}]}\n",
617
- "\n",
618
- "try:\n",
619
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
620
- "except Exception as e:\n",
621
- " print(e)"
622
- ]
623
- },
624
- {
625
- "cell_type": "code",
626
- "execution_count": null,
627
- "metadata": {},
628
- "outputs": [],
629
- "source": [
630
- "# Invalid constraint value: specprimary\n",
631
- "\n",
632
- "cons = {'specprimary': ['chrysanthemum']}\n",
633
- "\n",
634
- "try:\n",
635
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
636
- "except Exception as e:\n",
637
- " print(e)"
638
- ]
639
- },
640
- {
641
- "cell_type": "code",
642
- "execution_count": null,
643
- "metadata": {},
644
- "outputs": [],
645
- "source": [
646
- "# Invalid constraint value: spectype\n",
647
- "\n",
648
- "cons = {'spectype': [{'tulip'}]}\n",
649
- "\n",
650
- "try:\n",
651
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
652
- "except Exception as e:\n",
653
- " print(e)"
654
- ]
655
- },
656
- {
657
- "cell_type": "code",
658
- "execution_count": null,
659
- "metadata": {},
660
- "outputs": [],
661
- "source": [
662
- "# Invalid constraint value: telescope\n",
663
- "\n",
664
- "cons = {'telescope': [{'carnation'}]}\n",
665
- "\n",
666
- "try:\n",
667
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
668
- "except Exception as e:\n",
669
- " print(e)"
670
- ]
671
- },
672
- {
673
- "cell_type": "code",
674
- "execution_count": null,
675
- "metadata": {},
676
- "outputs": [],
677
- "source": [
678
- "# Invalid constraint value: wavemax\n",
679
- "\n",
680
- "cons = {'wavemax': [10500]}\n",
681
- "\n",
682
- "try:\n",
683
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
684
- "except Exception as e:\n",
685
- " print(e)"
686
- ]
687
- },
688
- {
689
- "cell_type": "code",
690
- "execution_count": null,
691
- "metadata": {},
692
- "outputs": [],
693
- "source": [
694
- "# Invalid constraint value: wavemin\n",
695
- "\n",
696
- "cons = {'wavemin': [3800]}\n",
697
- "\n",
698
- "try:\n",
699
- " found = client.find(outfields=outs, constraints=cons, limit=10)\n",
700
- "except Exception as e:\n",
701
- " print(e)"
702
- ]
703
- },
704
- {
705
- "cell_type": "code",
706
- "execution_count": null,
707
- "metadata": {},
708
- "outputs": [],
709
- "source": [
710
- "# Test all possible constraint fields with specified constraint values,\n",
711
- "# SDSS-DR16 only\n",
712
- "\n",
713
- "cons = {'data_release': ['SDSS-DR16'],\n",
714
- " 'datasetgroup': ['SDSS_BOSS'],\n",
715
- " 'dateobs_center': ['2003-11-21 00:00','2011-12-21 00:00'],\n",
716
- " 'dec': [4,29],\n",
717
- " 'exptime': [2000,12000],\n",
718
- " 'instrument': ['SDSS','BOSS'],\n",
719
- " 'ra': [80,136],\n",
720
- " 'redshift': [2,5],\n",
721
- " 'redshift_err': [0.0001,0.001],\n",
722
- " 'redshift_warning': [0,3,5],\n",
723
- " 'site': ['apo'],\n",
724
- " 'specprimary': [1],\n",
725
- " 'spectype': ['QSO','GALAXY'],\n",
726
- " 'telescope': ['sloan25m'],\n",
727
- " 'wavemax': [9210,10500],\n",
728
- " 'wavemin': [3800,3900]}\n",
729
- "\n",
730
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
731
- "print(f\"# records found: {len(found.records)}\")\n",
732
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
733
- "print(f\"First record: {found.records[0]}\")"
734
- ]
735
- },
736
- {
737
- "cell_type": "code",
738
- "execution_count": null,
739
- "metadata": {},
740
- "outputs": [],
741
- "source": [
742
- "# Test all possible constraint fields with specified constraint values,\n",
743
- "# BOSS-DR16 only\n",
744
- "\n",
745
- "cons = {'data_release': ['BOSS-DR16'],\n",
746
- " 'datasetgroup': ['SDSS_BOSS'],\n",
747
- " 'dateobs_center': ['2018-10-07 08:44:43+00:00', '2018-10-07 08:44:43+00:00'],\n",
748
- " 'dec': [4,20],\n",
749
- " 'exptime': [2000,12000],\n",
750
- " 'instrument': ['SDSS','BOSS'],\n",
751
- " 'ra': [20,150],\n",
752
- " 'redshift': [0,3],\n",
753
- " 'redshift_err': [0.0001,0.002],\n",
754
- " 'redshift_warning': [0],\n",
755
- " 'site': ['apo'],\n",
756
- " 'specprimary': [1],\n",
757
- " 'spectype': ['QSO','GALAXY'],\n",
758
- " 'telescope': ['sloan25m'],\n",
759
- " 'wavemax': [9210,10500],\n",
760
- " 'wavemin': [3200,3900]}\n",
761
- "\n",
762
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
763
- "print(f\"# records found: {len(found.records)}\")\n",
764
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
765
- "print(f\"First record: {found.records[0]}\")"
766
- ]
767
- },
768
- {
769
- "cell_type": "code",
770
- "execution_count": null,
771
- "metadata": {},
772
- "outputs": [],
773
- "source": [
774
- "# Test constraint fields with specified constraint values,\n",
775
- "# DESI-EDR only\n",
776
- "\n",
777
- "cons = {'data_release': ['DESI-EDR'],\n",
778
- " 'dec': [50,90],\n",
779
- " 'exptime': [2000,2500],\n",
780
- " 'instrument': ['DESI'],\n",
781
- " 'ra': [150,190],\n",
782
- " 'redshift': [1,1.7],\n",
783
- " 'redshift_err': [0.00006,0.0001],\n",
784
- " 'redshift_warning': [0,5],\n",
785
- " 'site': ['kpno'],\n",
786
- " 'specprimary': [1],\n",
787
- " 'spectype': ['GALAXY','STAR'],\n",
788
- " 'telescope': ['kp4m'],\n",
789
- " 'wavemax': [9700,9900],\n",
790
- " 'wavemin': [3500,3700]}\n",
791
- "\n",
792
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
793
- "print(f\"# records found: {len(found.records)}\")\n",
794
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
795
- "print(f\"First record: {found.records[0]}\")"
796
- ]
797
- },
798
- {
799
- "cell_type": "code",
800
- "execution_count": null,
801
- "metadata": {},
802
- "outputs": [],
803
- "source": [
804
- "# Test constraint fields with specified constraint values,\n",
805
- "# all datasets\n",
806
- "\n",
807
- "cons = {'data_release': ['BOSS-DR16','SDSS-DR16','DESI-EDR'],\n",
808
- " 'datasetgroup': ['SDSS_BOSS','DESI'],\n",
809
- " 'dec': [4,29],\n",
810
- " 'exptime': [2000,12000],\n",
811
- " 'instrument': ['SDSS','BOSS','DESI'],\n",
812
- " 'ra': [80,136],\n",
813
- " 'redshift': [2,5],\n",
814
- " 'redshift_err': [0.0001,0.001],\n",
815
- " 'redshift_warning': [0,3,5],\n",
816
- " 'site': ['apo','kpno'],\n",
817
- " 'specprimary': [1],\n",
818
- " 'spectype': ['QSO','GALAXY'],\n",
819
- " 'telescope': ['sloan25m','kp4m']}\n",
820
- "\n",
821
- "found = client.find(outfields=outs, constraints=cons, limit=50)\n",
822
- "print(f\"# records found: {len(found.records)}\")\n",
823
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
824
- "print(f\"First record: {found.records[0]}\")"
825
- ]
826
- },
827
- {
828
- "cell_type": "code",
829
- "execution_count": null,
830
- "metadata": {},
831
- "outputs": [],
832
- "source": [
833
- "# Test combo of constraint fields with specified constraint values:\n",
834
- "# datasetgroup, redshift, specprimary, redshift_warning, spectype\n",
835
- "\n",
836
- "cons = {'datasetgroup': ['SDSS_BOSS'],\n",
837
- " 'redshift': [0,0.2],\n",
838
- " 'specprimary': [1],\n",
839
- " 'redshift_warning': [0],\n",
840
- " 'spectype': ['STAR']}\n",
841
- "\n",
842
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
843
- "print(f\"# records found: {len(found.records)}\")\n",
844
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
845
- "print(f\"First record: {found.records[0]}\")"
846
- ]
847
- },
848
- {
849
- "cell_type": "code",
850
- "execution_count": null,
851
- "metadata": {},
852
- "outputs": [],
853
- "source": [
854
- "# Test combo of constraint fields with specified constraint values:\n",
855
- "# datasetgroup, exptime, redshift_warning\n",
856
- "\n",
857
- "cons = {'datasetgroup': ['DESI'],\n",
858
- " 'exptime': [1000.2,1000.6],\n",
859
- " 'redshift_warning': [4]}\n",
860
- "\n",
861
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
862
- "print(f\"# records found: {len(found.records)}\")\n",
863
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
864
- "print(f\"First record: {found.records[0]}\")"
865
- ]
866
- },
867
- {
868
- "cell_type": "code",
869
- "execution_count": null,
870
- "metadata": {},
871
- "outputs": [],
872
- "source": [
873
- "# Test instrument and telescope constraint fields, SDSS-DR16 only\n",
874
- "\n",
875
- "cons = {'instrument': ['SDSS'],\n",
876
- " 'telescope': ['sloan25m']}\n",
877
- "\n",
878
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
879
- "print(f\"# records found: {len(found.records)}\")\n",
880
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
881
- "print(f\"First record: {found.records[0]}\")"
882
- ]
883
- },
884
- {
885
- "cell_type": "code",
886
- "execution_count": null,
887
- "metadata": {},
888
- "outputs": [],
889
- "source": [
890
- "# Test instrument and telescope constraint fields, BOSS-DR16 only\n",
891
- "\n",
892
- "cons = {'instrument': ['BOSS'],\n",
893
- " 'telescope': ['sloan25m']}\n",
894
- "\n",
895
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
896
- "print(f\"# records found: {len(found.records)}\")\n",
897
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
898
- "print(f\"First record: {found.records[0]}\")"
899
- ]
900
- },
901
- {
902
- "cell_type": "code",
903
- "execution_count": null,
904
- "metadata": {},
905
- "outputs": [],
906
- "source": [
907
- "# Test instrument and telescope constraint fields, DESI-EDR only\n",
908
- "\n",
909
- "cons = {'instrument': ['DESI'],\n",
910
- " 'telescope': ['kp4m']}\n",
911
- "\n",
912
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
913
- "print(f\"# records found: {len(found.records)}\")\n",
914
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
915
- "print(f\"First record: {found.records[0]}\")"
916
- ]
917
- },
918
- {
919
- "cell_type": "code",
920
- "execution_count": null,
921
- "metadata": {},
922
- "outputs": [],
923
- "source": [
924
- "# Test combo of constraint fields with specified constraint values:\n",
925
- "# site, specprimary, spectype\n",
926
- "\n",
927
- "cons = {'site': ['apo'],\n",
928
- " 'specprimary': [1],\n",
929
- " 'spectype': ['STAR']}\n",
930
- "\n",
931
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
932
- "print(f\"# records found: {len(found.records)}\")\n",
933
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
934
- "print(f\"First record: {found.records[0]}\")"
935
- ]
936
- },
937
- {
938
- "cell_type": "code",
939
- "execution_count": null,
940
- "metadata": {},
941
- "outputs": [],
942
- "source": [
943
- "# Test combo of constraint fields with specified constraint values:\n",
944
- "# site, specprimary, exptime\n",
945
- "\n",
946
- "cons = {'site': ['kpno'],\n",
947
- " 'specprimary': [1],\n",
948
- " 'exptime': [3000,3010]}\n",
949
- "\n",
950
- "found = client.find(outfields=outs, constraints=cons, limit=10)\n",
951
- "print(f\"# records found: {len(found.records)}\")\n",
952
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
953
- "print(f\"First record: {found.records[0]}\")"
954
- ]
955
- },
956
- {
957
- "cell_type": "markdown",
958
- "metadata": {},
959
- "source": [
960
- "<a class=\"anchor\" id=\"find_outfields\"></a>\n",
961
- "### parameter to test: outfields"
962
- ]
963
- },
964
- {
965
- "cell_type": "code",
966
- "execution_count": null,
967
- "metadata": {},
968
- "outputs": [],
969
- "source": [
970
- "# No constraints passed, no limit passed\n",
971
- "\n",
972
- "found = client.find(outfields=outs)\n",
973
- "print(f\"# records found: {len(found.records)}\")\n",
974
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
975
- "print(f\"First record: {found.records[0]}\")"
976
- ]
977
- },
978
- {
979
- "cell_type": "code",
980
- "execution_count": null,
981
- "metadata": {},
982
- "outputs": [],
983
- "source": [
984
- "# AUX field in only SDSS-DR16 and BOSS-DR16\n",
985
- "found = client.find(outfields=['run2d','data_release'])\n",
986
- "print(f\"# records found: {len(found.records)}\")\n",
987
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
988
- "print(f\"First record: {found.records[0]}\")"
989
- ]
990
- },
991
- {
992
- "cell_type": "code",
993
- "execution_count": null,
994
- "metadata": {},
995
- "outputs": [],
996
- "source": [
997
- "# AUX field in only DESI-EDR\n",
998
- "found = client.find(outfields=['healpix','data_release'])\n",
999
- "print(f\"# records found: {len(found.records)}\")\n",
1000
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1001
- "print(f\"First record: {found.records[0]}\")"
1002
- ]
1003
- },
1004
- {
1005
- "cell_type": "code",
1006
- "execution_count": null,
1007
- "metadata": {},
1008
- "outputs": [],
1009
- "source": [
1010
- "# AUX field in all datasets\n",
1011
- "found = client.find(outfields=['survey','data_release'])\n",
1012
- "print(f\"# records found: {len(found.records)}\")\n",
1013
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1014
- "print(f\"First record: {found.records[0]}\")"
1015
- ]
1016
- },
1017
- {
1018
- "cell_type": "code",
1019
- "execution_count": null,
1020
- "metadata": {},
1021
- "outputs": [],
1022
- "source": [
1023
- "# Field does not exist in any dataset\n",
1024
- "found = client.find(outfields=['petunia'])\n",
1025
- "print(f\"# records found: {len(found.records)}\")\n",
1026
- "print(f\"First record: {found.records[0]}\")"
1027
- ]
1028
- },
1029
- {
1030
- "cell_type": "code",
1031
- "execution_count": null,
1032
- "metadata": {},
1033
- "outputs": [],
1034
- "source": [
1035
- "# Field exists in at least one dataset\n",
1036
- "found = client.find(outfields=['fiberid','data_release'])\n",
1037
- "print(f\"# records found: {len(found.records)}\")\n",
1038
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1039
- "print(f\"First record: {found.records[0]}\")"
1040
- ]
1041
- },
1042
- {
1043
- "cell_type": "code",
1044
- "execution_count": null,
1045
- "metadata": {},
1046
- "outputs": [],
1047
- "source": [
1048
- "# One field exists in at least one dataset, another field does not exist\n",
1049
- "# in any datasets\n",
1050
- "found = client.find(outfields=['plate','dahlia','data_release'])\n",
1051
- "print(f\"# records found: {len(found.records)}\")\n",
1052
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1053
- "print(f\"First record: {found.records[0]}\")"
1054
- ]
1055
- },
1056
- {
1057
- "cell_type": "code",
1058
- "execution_count": null,
1059
- "metadata": {},
1060
- "outputs": [],
1061
- "source": [
1062
- "# A field does not exist in the specified data_release\n",
1063
- "try:\n",
1064
- " found = client.find(outfields=['location','data_release'],constraints={'data_release':['SDSS-DR16']})\n",
1065
- " print(f\"# records found: {len(found.records)}\")\n",
1066
- " print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1067
- " print(f\"First record: {found.records[0]}\")\n",
1068
- "except Exception as e:\n",
1069
- " print(e)"
1070
- ]
1071
- },
1072
- {
1073
- "cell_type": "code",
1074
- "execution_count": null,
1075
- "metadata": {},
1076
- "outputs": [],
1077
- "source": [
1078
- "# A field exists in only one of the specified data_releases\n",
1079
- "found = client.find(outfields=['sv_primary','data_release'],constraints={'data_release':['SDSS-DR16','DESI-EDR']})\n",
1080
- "print(f\"# records found: {len(found.records)}\")\n",
1081
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\")\n",
1082
- "print(f\"First record: {found.records[0]}\")"
1083
- ]
1084
- },
1085
- {
1086
- "cell_type": "markdown",
1087
- "metadata": {},
1088
- "source": [
1089
- "<a class=\"anchor\" id=\"find_sort\"></a>\n",
1090
- "### parameter to test: sort"
1091
- ]
1092
- },
1093
- {
1094
- "cell_type": "code",
1095
- "execution_count": null,
1096
- "metadata": {},
1097
- "outputs": [],
1098
- "source": [
1099
- "def sortby(sort_field,cons={},lim=500):\n",
1100
- " found = client.find(outfields=outs,constraints=cons,sort=f'{sort_field}',limit=lim)\n",
1101
- " print(f\"Records found: {len(found.records)}\")\n",
1102
- " print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\\n\")\n",
1103
- " print(f\"First record: {found.records[0]}\\n\")\n",
1104
- " print(f\"{sort_field} in first 5 records:\")\n",
1105
- " for i in range(5):\n",
1106
- " print(found.records[i][sort_field])\n",
1107
- " print(f\"\\n{sort_field} in last 5 records:\")\n",
1108
- " for i in range(495,500):\n",
1109
- " print(found.records[i][sort_field])"
1110
- ]
1111
- },
1112
- {
1113
- "cell_type": "code",
1114
- "execution_count": null,
1115
- "metadata": {},
1116
- "outputs": [],
1117
- "source": [
1118
- "sortby('dateobs_center',cons={'dateobs_center':['2000-05-02T23:59:59Z','2000-08-07T03:47:16Z']})"
1119
- ]
1120
- },
1121
- {
1122
- "cell_type": "code",
1123
- "execution_count": null,
1124
- "metadata": {},
1125
- "outputs": [],
1126
- "source": [
1127
- "sortby('dec',cons={'dec':[4,4.3]})"
1128
- ]
1129
- },
1130
- {
1131
- "cell_type": "code",
1132
- "execution_count": null,
1133
- "metadata": {},
1134
- "outputs": [],
1135
- "source": [
1136
- "sortby('exptime')"
1137
- ]
1138
- },
1139
- {
1140
- "cell_type": "code",
1141
- "execution_count": null,
1142
- "metadata": {},
1143
- "outputs": [],
1144
- "source": [
1145
- "sortby('ra',cons={'ra':[3,3.3]})"
1146
- ]
1147
- },
1148
- {
1149
- "cell_type": "code",
1150
- "execution_count": null,
1151
- "metadata": {},
1152
- "outputs": [],
1153
- "source": [
1154
- "sortby('redshift',cons={'redshift':[0.9,0.91]})"
1155
- ]
1156
- },
1157
- {
1158
- "cell_type": "code",
1159
- "execution_count": null,
1160
- "metadata": {},
1161
- "outputs": [],
1162
- "source": [
1163
- "sortby('redshift_err',cons={'redshift_err':[10.0,20.0]})"
1164
- ]
1165
- },
1166
- {
1167
- "cell_type": "code",
1168
- "execution_count": null,
1169
- "metadata": {},
1170
- "outputs": [],
1171
- "source": [
1172
- "sortby('redshift_warning',cons={'redshift_warning':[1,3,5]})"
1173
- ]
1174
- },
1175
- {
1176
- "cell_type": "code",
1177
- "execution_count": null,
1178
- "metadata": {},
1179
- "outputs": [],
1180
- "source": [
1181
- "found = client.find(outfields=outs,sort='id')\n",
1182
- "print(f\"# records found: {len(found.records)}\")\n",
1183
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\\n\")\n",
1184
- "print(f\"First record: {found.records[0]}\\n\")\n",
1185
- "print(\"sparcl_id in first 5 records:\")\n",
1186
- "for i in range(5):\n",
1187
- " print(found.records[i].sparcl_id)\n",
1188
- "print(\"\\nsparcl_id in last 5 records:\")\n",
1189
- "for i in range(495,500):\n",
1190
- " print(found.records[i].sparcl_id)"
1191
- ]
1192
- },
1193
- {
1194
- "cell_type": "code",
1195
- "execution_count": null,
1196
- "metadata": {},
1197
- "outputs": [],
1198
- "source": [
1199
- "sortby('specid',cons={'data_release':['DESI-EDR']})"
1200
- ]
1201
- },
1202
- {
1203
- "cell_type": "code",
1204
- "execution_count": null,
1205
- "metadata": {},
1206
- "outputs": [],
1207
- "source": [
1208
- "sortby('specprimary',cons={'data_release':['BOSS-DR16','DESI-EDR']},lim=1000)"
1209
- ]
1210
- },
1211
- {
1212
- "cell_type": "code",
1213
- "execution_count": null,
1214
- "metadata": {},
1215
- "outputs": [],
1216
- "source": [
1217
- "sortby('spectype')"
1218
- ]
1219
- },
1220
- {
1221
- "cell_type": "code",
1222
- "execution_count": null,
1223
- "metadata": {},
1224
- "outputs": [],
1225
- "source": [
1226
- "sortby('targetid',cons={'data_release':['DESI-EDR']})"
1227
- ]
1228
- },
1229
- {
1230
- "cell_type": "code",
1231
- "execution_count": null,
1232
- "metadata": {},
1233
- "outputs": [],
1234
- "source": [
1235
- "sortby('wavemax',cons={'wavemax':[10,10000]})"
1236
- ]
1237
- },
1238
- {
1239
- "cell_type": "code",
1240
- "execution_count": null,
1241
- "metadata": {},
1242
- "outputs": [],
1243
- "source": [
1244
- "sortby('wavemin',cons={'data_release':['SDSS-DR16','BOSS-DR16'],'wavemin':[1,5000]})"
1245
- ]
1246
- },
1247
- {
1248
- "cell_type": "code",
1249
- "execution_count": null,
1250
- "metadata": {},
1251
- "outputs": [],
1252
- "source": [
1253
- "print(\"\\n###################### UNSORTED ######################\\n\")\n",
1254
- "found = client.find(outfields=outs,constraints={'ra':[1,200],'dec':[0,80]})\n",
1255
- "print(f\"Records found: {len(found.records)}\")\n",
1256
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\\n\")\n",
1257
- "print(f\"First record: {found.records[0]}\\n\")\n",
1258
- "print(f\"ra, dec in first 5 records:\")\n",
1259
- "for i in range(5):\n",
1260
- " print(f\"{found.records[i]['ra']}, {found.records[i]['dec']}\")\n",
1261
- "print(f\"\\nra, dec in last 5 records:\")\n",
1262
- "for i in range(495,500):\n",
1263
- " print(f\"{found.records[i]['ra']}, {found.records[i]['dec']}\")\n",
1264
- "\n",
1265
- "print(\"\\n###################### SORTED ######################\\n\")\n",
1266
- "found = client.find(outfields=outs,constraints={'ra':[1,200],'dec':[0,80]},sort='ra,dec')\n",
1267
- "print(f\"Records found: {len(found.records)}\")\n",
1268
- "print(f\"Datasets found: {set([f['data_release'] for f in found.records])}\\n\")\n",
1269
- "print(f\"First record: {found.records[0]}\\n\")\n",
1270
- "print(f\"ra, dec in first 5 records:\")\n",
1271
- "for i in range(5):\n",
1272
- " print(f\"{found.records[i]['ra']}, {found.records[i]['dec']}\")\n",
1273
- "print(f\"\\nra, dec in last 5 records:\")\n",
1274
- "for i in range(495,500):\n",
1275
- " print(f\"{found.records[i]['ra']}, {found.records[i]['dec']}\")"
1276
- ]
1277
- },
1278
- {
1279
- "cell_type": "markdown",
1280
- "metadata": {},
1281
- "source": [
1282
- "<a class=\"anchor\" id=\"retrieve\"></a>\n",
1283
- "## client.retrieve()"
1284
- ]
1285
- },
1286
- {
1287
- "cell_type": "code",
1288
- "execution_count": null,
1289
- "metadata": {},
1290
- "outputs": [],
1291
- "source": [
1292
- "client.retrieve?"
1293
- ]
1294
- },
1295
- {
1296
- "cell_type": "code",
1297
- "execution_count": null,
1298
- "metadata": {},
1299
- "outputs": [],
1300
- "source": [
1301
- "ids_lots = client.find(limit=60000).ids"
1302
- ]
1303
- },
1304
- {
1305
- "cell_type": "code",
1306
- "execution_count": null,
1307
- "metadata": {},
1308
- "outputs": [],
1309
- "source": [
1310
- "# ids from SDSS-DR16 only\n",
1311
- "ids_sdss = client.find(outfields=['sparcl_id'],\n",
1312
- " constraints={'data_release':['SDSS-DR16']},\n",
1313
- " limit=3).ids\n",
1314
- "\n",
1315
- "# ids from BOSS-DR16 only\n",
1316
- "ids_boss = client.find(outfields=['sparcl_id'],\n",
1317
- " constraints={'data_release':['BOSS-DR16']},\n",
1318
- " limit=3).ids\n",
1319
- "\n",
1320
- "# ids from DESI-EDR only\n",
1321
- "ids_desi = client.find(outfields=['sparcl_id'],\n",
1322
- " constraints={'data_release':['DESI-EDR']},\n",
1323
- " limit=3).ids\n",
1324
- "\n",
1325
- "# ids from any dataset\n",
1326
- "ids_any = ids_sdss + ids_boss + ids_desi"
1327
- ]
1328
- },
1329
- {
1330
- "cell_type": "markdown",
1331
- "metadata": {},
1332
- "source": [
1333
- "<a class=\"anchor\" id=\"retrieve_limit\"></a>\n",
1334
- "### parameter to test: limit"
1335
- ]
1336
- },
1337
- {
1338
- "cell_type": "code",
1339
- "execution_count": null,
1340
- "metadata": {},
1341
- "outputs": [],
1342
- "source": [
1343
- "# does the default limit work?\n",
1344
- "client.retrieve(uuid_list=ids_lots)"
1345
- ]
1346
- },
1347
- {
1348
- "cell_type": "code",
1349
- "execution_count": null,
1350
- "metadata": {},
1351
- "outputs": [],
1352
- "source": [
1353
- "# does setting a limit less than the default value work?\n",
1354
- "client.retrieve(uuid_list=ids_lots,limit=2)"
1355
- ]
1356
- },
1357
- {
1358
- "cell_type": "code",
1359
- "execution_count": null,
1360
- "metadata": {},
1361
- "outputs": [],
1362
- "source": [
1363
- "# does setting a limit over the default value but under\n",
1364
- "# the maximum value work?\n",
1365
- "client.retrieve(uuid_list=ids_lots,limit=800)"
1366
- ]
1367
- },
1368
- {
1369
- "cell_type": "code",
1370
- "execution_count": null,
1371
- "metadata": {},
1372
- "outputs": [],
1373
- "source": [
1374
- "# does trying to retrieve more than the maximum allowed\n",
1375
- "# by setting limit=30000 produce the right error message?\n",
1376
- "try:\n",
1377
- " client.retrieve(uuid_list=ids_lots,limit=30000)\n",
1378
- "except Exception as e:\n",
1379
- " print(e)"
1380
- ]
1381
- },
1382
- {
1383
- "cell_type": "code",
1384
- "execution_count": null,
1385
- "metadata": {},
1386
- "outputs": [],
1387
- "source": [
1388
- "# does trying to retrieve more than the maximum allowed\n",
1389
- "# by setting limit=None produce the right error message?\n",
1390
- "try:\n",
1391
- " client.retrieve(uuid_list=ids_lots,limit=None)\n",
1392
- "except Exception as e:\n",
1393
- " print(e)"
1394
- ]
1395
- },
1396
- {
1397
- "cell_type": "markdown",
1398
- "metadata": {},
1399
- "source": [
1400
- "<a class=\"anchor\" id=\"retrieve_dataset_list\"></a>\n",
1401
- "### parameter to test: dataset_list"
1402
- ]
1403
- },
1404
- {
1405
- "cell_type": "code",
1406
- "execution_count": null,
1407
- "metadata": {},
1408
- "outputs": [],
1409
- "source": [
1410
- "# Retrieve from all datasets (dataset_list=None, the default)\n",
1411
- "r = client.retrieve(uuid_list=ids_any, include=['data_release'])\n",
1412
- "set([f['data_release'] for f in r.records])"
1413
- ]
1414
- },
1415
- {
1416
- "cell_type": "code",
1417
- "execution_count": null,
1418
- "metadata": {},
1419
- "outputs": [],
1420
- "source": [
1421
- "# Retrieve from only SDSS-DR16 (should get a warning about missing ids)\n",
1422
- "r = client.retrieve(uuid_list=ids_any, include=['data_release'], dataset_list=['SDSS-DR16'])\n",
1423
- "set([f['data_release'] for f in r.records])"
1424
- ]
1425
- },
1426
- {
1427
- "cell_type": "code",
1428
- "execution_count": null,
1429
- "metadata": {},
1430
- "outputs": [],
1431
- "source": [
1432
- "# Retrieve from only BOSS-DR16 (should get a warning about missing ids)\n",
1433
- "r = client.retrieve(uuid_list=ids_any, include=['data_release'], dataset_list=['BOSS-DR16'])\n",
1434
- "set([f['data_release'] for f in r.records])"
1435
- ]
1436
- },
1437
- {
1438
- "cell_type": "code",
1439
- "execution_count": null,
1440
- "metadata": {},
1441
- "outputs": [],
1442
- "source": [
1443
- "# Retrieve from only DESI-EDR (should get a warning about missing ids)\n",
1444
- "r = client.retrieve(uuid_list=ids_any, include=['data_release'], dataset_list=['DESI-EDR'])\n",
1445
- "set([f['data_release'] for f in r.records])"
1446
- ]
1447
- },
1448
- {
1449
- "cell_type": "code",
1450
- "execution_count": null,
1451
- "metadata": {},
1452
- "outputs": [],
1453
- "source": [
1454
- "# Retrieve from only SDSS-DR16 and DESI-EDR (should get a warning about missing ids)\n",
1455
- "r = client.retrieve(uuid_list=ids_any, include=['data_release'], dataset_list=['SDSS-DR16','DESI-EDR'])\n",
1456
- "set([f['data_release'] for f in r.records])"
1457
- ]
1458
- },
1459
- {
1460
- "cell_type": "markdown",
1461
- "metadata": {},
1462
- "source": [
1463
- "<a class=\"anchor\" id=\"retrieve_include\"></a>\n",
1464
- "### parameter to test: include"
1465
- ]
1466
- },
1467
- {
1468
- "cell_type": "code",
1469
- "execution_count": null,
1470
- "metadata": {},
1471
- "outputs": [],
1472
- "source": [
1473
- "# include only default fields common to all datasets\n",
1474
- "r = client.retrieve(uuid_list=ids_any, include='DEFAULT')\n",
1475
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1476
- ]
1477
- },
1478
- {
1479
- "cell_type": "code",
1480
- "execution_count": null,
1481
- "metadata": {},
1482
- "outputs": [],
1483
- "source": [
1484
- "# include all fields common to all datasets\n",
1485
- "r = client.retrieve(uuid_list=ids_any, include='ALL')\n",
1486
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1487
- ]
1488
- },
1489
- {
1490
- "cell_type": "code",
1491
- "execution_count": null,
1492
- "metadata": {},
1493
- "outputs": [],
1494
- "source": [
1495
- "# include all fields in SDSS-DR16 only (should get a warning about missing ids)\n",
1496
- "r = client.retrieve(uuid_list=ids_any, include='ALL', dataset_list=['SDSS-DR16'])\n",
1497
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1498
- ]
1499
- },
1500
- {
1501
- "cell_type": "code",
1502
- "execution_count": null,
1503
- "metadata": {},
1504
- "outputs": [],
1505
- "source": [
1506
- "# include all fields in BOSS-DR16 only (should get a warning about missing ids)\n",
1507
- "r = client.retrieve(uuid_list=ids_any, include='ALL', dataset_list=['BOSS-DR16'])\n",
1508
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1509
- ]
1510
- },
1511
- {
1512
- "cell_type": "code",
1513
- "execution_count": null,
1514
- "metadata": {},
1515
- "outputs": [],
1516
- "source": [
1517
- "# include all fields in DESI-EDR only (should get a warning about missing ids)\n",
1518
- "r = client.retrieve(uuid_list=ids_any, include='ALL', dataset_list=['DESI-EDR'])\n",
1519
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1520
- ]
1521
- },
1522
- {
1523
- "cell_type": "code",
1524
- "execution_count": null,
1525
- "metadata": {},
1526
- "outputs": [],
1527
- "source": [
1528
- "# include all fields in SDSS-DR16 and DESI-EDR only (should get a warning about missing ids)\n",
1529
- "r = client.retrieve(uuid_list=ids_any, include='ALL', dataset_list=['SDSS-DR16','DESI-EDR'])\n",
1530
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1531
- ]
1532
- },
1533
- {
1534
- "cell_type": "code",
1535
- "execution_count": null,
1536
- "metadata": {},
1537
- "outputs": [],
1538
- "source": [
1539
- "# include only specified fields\n",
1540
- "r = client.retrieve(uuid_list=ids_any, include=['sparcl_id','flux','redshift'])\n",
1541
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1542
- ]
1543
- },
1544
- {
1545
- "cell_type": "code",
1546
- "execution_count": null,
1547
- "metadata": {},
1548
- "outputs": [],
1549
- "source": [
1550
- "# include aux fields in SDSS-DR16 only\n",
1551
- "r = client.retrieve(uuid_list=ids_sdss, include=['run2d','primtarget'], dataset_list=['SDSS-DR16'])\n",
1552
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1553
- ]
1554
- },
1555
- {
1556
- "cell_type": "code",
1557
- "execution_count": null,
1558
- "metadata": {},
1559
- "outputs": [],
1560
- "source": [
1561
- "# include aux fields in BOSS-DR16 only\n",
1562
- "r = client.retrieve(uuid_list=ids_boss, include=['fiberid','mjd'], dataset_list=['BOSS-DR16'])\n",
1563
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1564
- ]
1565
- },
1566
- {
1567
- "cell_type": "code",
1568
- "execution_count": null,
1569
- "metadata": {},
1570
- "outputs": [],
1571
- "source": [
1572
- "# include aux fields in BOSS-DR16 only\n",
1573
- "r = client.retrieve(uuid_list=ids_any, include=['fiberid','mjd'], dataset_list=['BOSS-DR16'])\n",
1574
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1575
- ]
1576
- },
1577
- {
1578
- "cell_type": "code",
1579
- "execution_count": null,
1580
- "metadata": {},
1581
- "outputs": [],
1582
- "source": [
1583
- "# include aux fields in DESI-EDR only\n",
1584
- "r = client.retrieve(uuid_list=ids_desi, include=['survey','sv_primary'], dataset_list=['DESI-EDR'])\n",
1585
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1586
- ]
1587
- },
1588
- {
1589
- "cell_type": "code",
1590
- "execution_count": null,
1591
- "metadata": {},
1592
- "outputs": [],
1593
- "source": [
1594
- "# try to include fields that do not exist in the DB\n",
1595
- "try:\n",
1596
- " r = client.retrieve(uuid_list=ids_any, include=['sparcl_id','magnolia'])\n",
1597
- " print([set(r.records[i].keys()) for i in range(len(r.records))][0])\n",
1598
- "except Exception as e:\n",
1599
- " print(e)"
1600
- ]
1601
- },
1602
- {
1603
- "cell_type": "markdown",
1604
- "metadata": {},
1605
- "source": [
1606
- "<a class=\"anchor\" id=\"retrieve_by_specid\"></a>\n",
1607
- "## client.retrieve_by_specid()"
1608
- ]
1609
- },
1610
- {
1611
- "cell_type": "code",
1612
- "execution_count": null,
1613
- "metadata": {},
1614
- "outputs": [],
1615
- "source": [
1616
- "client.retrieve_by_specid?"
1617
- ]
1618
- },
1619
- {
1620
- "cell_type": "code",
1621
- "execution_count": null,
1622
- "metadata": {},
1623
- "outputs": [],
1624
- "source": [
1625
- "found_specids = client.find(outfields=['specid'],limit=60000)\n",
1626
- "specids_lots = [f['specid'] for f in found_specids.records]"
1627
- ]
1628
- },
1629
- {
1630
- "cell_type": "code",
1631
- "execution_count": null,
1632
- "metadata": {},
1633
- "outputs": [],
1634
- "source": [
1635
- "# specids from SDSS-DR16 only\n",
1636
- "found_sdss = client.find(outfields=['specid'],\n",
1637
- " constraints={'data_release':['SDSS-DR16']},\n",
1638
- " limit=3)\n",
1639
- "specids_sdss = [f['specid'] for f in found_sdss.records]\n",
1640
- "\n",
1641
- "# specids from BOSS-DR16 only\n",
1642
- "found_boss = client.find(outfields=['specid'],\n",
1643
- " constraints={'data_release':['BOSS-DR16']},\n",
1644
- " limit=3)\n",
1645
- "specids_boss = [f['specid'] for f in found_boss.records]\n",
1646
- "\n",
1647
- "# specids from DESI-EDR only\n",
1648
- "found_desi = client.find(outfields=['specid'],\n",
1649
- " constraints={'data_release':['DESI-EDR']},\n",
1650
- " limit=3)\n",
1651
- "specids_desi = [f['specid'] for f in found_desi.records]\n",
1652
- "\n",
1653
- "# specids from any dataset\n",
1654
- "specids_any = specids_sdss + specids_boss + specids_desi"
1655
- ]
1656
- },
1657
- {
1658
- "cell_type": "markdown",
1659
- "metadata": {},
1660
- "source": [
1661
- "<a class=\"anchor\" id=\"retrieve_by_specid_limit\"></a>\n",
1662
- "### parameter to test: limit"
1663
- ]
1664
- },
1665
- {
1666
- "cell_type": "code",
1667
- "execution_count": null,
1668
- "metadata": {},
1669
- "outputs": [],
1670
- "source": [
1671
- "# does the default limit work?\n",
1672
- "client.retrieve_by_specid(specid_list=specids_lots)"
1673
- ]
1674
- },
1675
- {
1676
- "cell_type": "code",
1677
- "execution_count": null,
1678
- "metadata": {},
1679
- "outputs": [],
1680
- "source": [
1681
- "# does setting a limit less than the default value work?\n",
1682
- "client.retrieve_by_specid(specid_list=specids_lots,limit=2)"
1683
- ]
1684
- },
1685
- {
1686
- "cell_type": "code",
1687
- "execution_count": null,
1688
- "metadata": {},
1689
- "outputs": [],
1690
- "source": [
1691
- "# does setting a limit over the default value but under\n",
1692
- "# the maximum value work?\n",
1693
- "client.retrieve_by_specid(specid_list=specids_lots,limit=800)"
1694
- ]
1695
- },
1696
- {
1697
- "cell_type": "code",
1698
- "execution_count": null,
1699
- "metadata": {},
1700
- "outputs": [],
1701
- "source": [
1702
- "# does trying to retrieve more than the maximum allowed\n",
1703
- "# by setting limit=30000 produce the right error message?\n",
1704
- "try:\n",
1705
- " client.retrieve_by_specid(specid_list=specids_lots,limit=30000)\n",
1706
- "except Exception as e:\n",
1707
- " print(e)"
1708
- ]
1709
- },
1710
- {
1711
- "cell_type": "code",
1712
- "execution_count": null,
1713
- "metadata": {},
1714
- "outputs": [],
1715
- "source": [
1716
- "# does trying to retrieve more than the maximum allowed\n",
1717
- "# by setting limit=None produce the right error message?\n",
1718
- "try:\n",
1719
- " client.retrieve_by_specid(specid_list=specids_lots,limit=None)\n",
1720
- "except Exception as e:\n",
1721
- " print(e)"
1722
- ]
1723
- },
1724
- {
1725
- "cell_type": "markdown",
1726
- "metadata": {},
1727
- "source": [
1728
- "<a class=\"anchor\" id=\"retrieve_by_specid_dataset_list\"></a>\n",
1729
- "### parameter to test: dataset_list"
1730
- ]
1731
- },
1732
- {
1733
- "cell_type": "code",
1734
- "execution_count": null,
1735
- "metadata": {},
1736
- "outputs": [],
1737
- "source": [
1738
- "# Retrieve from all datasets (dataset_list=None, the default)\n",
1739
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['data_release'])\n",
1740
- "set([f['data_release'] for f in r.records])"
1741
- ]
1742
- },
1743
- {
1744
- "cell_type": "code",
1745
- "execution_count": null,
1746
- "metadata": {},
1747
- "outputs": [],
1748
- "source": [
1749
- "# Retrieve from only SDSS-DR16\n",
1750
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['data_release'], dataset_list=['SDSS-DR16'])\n",
1751
- "set([f['data_release'] for f in r.records])"
1752
- ]
1753
- },
1754
- {
1755
- "cell_type": "code",
1756
- "execution_count": null,
1757
- "metadata": {},
1758
- "outputs": [],
1759
- "source": [
1760
- "# Retrieve from only BOSS-DR16\n",
1761
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['data_release'], dataset_list=['BOSS-DR16'])\n",
1762
- "set([f['data_release'] for f in r.records])"
1763
- ]
1764
- },
1765
- {
1766
- "cell_type": "code",
1767
- "execution_count": null,
1768
- "metadata": {},
1769
- "outputs": [],
1770
- "source": [
1771
- "# Retrieve from only DESI-EDR\n",
1772
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['data_release'], dataset_list=['DESI-EDR'])\n",
1773
- "set([f['data_release'] for f in r.records])"
1774
- ]
1775
- },
1776
- {
1777
- "cell_type": "code",
1778
- "execution_count": null,
1779
- "metadata": {},
1780
- "outputs": [],
1781
- "source": [
1782
- "# Retrieve from only SDSS-DR16 and DESI-EDR\n",
1783
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['data_release'], dataset_list=['SDSS-DR16','DESI-EDR'])\n",
1784
- "set([f['data_release'] for f in r.records])"
1785
- ]
1786
- },
1787
- {
1788
- "cell_type": "markdown",
1789
- "metadata": {},
1790
- "source": [
1791
- "<a class=\"anchor\" id=\"retrieve_by_specid_include\"></a>\n",
1792
- "### parameter to test: include"
1793
- ]
1794
- },
1795
- {
1796
- "cell_type": "code",
1797
- "execution_count": null,
1798
- "metadata": {},
1799
- "outputs": [],
1800
- "source": [
1801
- "# include only default fields common to all datasets\n",
1802
- "r = client.retrieve_by_specid(specid_list=specids_any, include='DEFAULT')\n",
1803
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1804
- ]
1805
- },
1806
- {
1807
- "cell_type": "code",
1808
- "execution_count": null,
1809
- "metadata": {},
1810
- "outputs": [],
1811
- "source": [
1812
- "# include all fields common to all datasets\n",
1813
- "r = client.retrieve_by_specid(specid_list=specids_any, include='ALL')\n",
1814
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1815
- ]
1816
- },
1817
- {
1818
- "cell_type": "code",
1819
- "execution_count": null,
1820
- "metadata": {},
1821
- "outputs": [],
1822
- "source": [
1823
- "# include all fields in SDSS-DR16 only\n",
1824
- "r = client.retrieve_by_specid(specid_list=specids_any, include='ALL', dataset_list=['SDSS-DR16'])\n",
1825
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1826
- ]
1827
- },
1828
- {
1829
- "cell_type": "code",
1830
- "execution_count": null,
1831
- "metadata": {},
1832
- "outputs": [],
1833
- "source": [
1834
- "# include all fields in BOSS-DR16 only\n",
1835
- "r = client.retrieve_by_specid(specid_list=specids_any, include='ALL', dataset_list=['BOSS-DR16'])\n",
1836
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1837
- ]
1838
- },
1839
- {
1840
- "cell_type": "code",
1841
- "execution_count": null,
1842
- "metadata": {},
1843
- "outputs": [],
1844
- "source": [
1845
- "# include all fields in DESI-EDR only\n",
1846
- "r = client.retrieve_by_specid(specid_list=specids_any, include='ALL', dataset_list=['DESI-EDR'])\n",
1847
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1848
- ]
1849
- },
1850
- {
1851
- "cell_type": "code",
1852
- "execution_count": null,
1853
- "metadata": {},
1854
- "outputs": [],
1855
- "source": [
1856
- "# include all fields in SDSS-DR16 and DESI-EDR only\n",
1857
- "r = client.retrieve_by_specid(specid_list=specids_any, include='ALL', dataset_list=['SDSS-DR16','DESI-EDR'])\n",
1858
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1859
- ]
1860
- },
1861
- {
1862
- "cell_type": "code",
1863
- "execution_count": null,
1864
- "metadata": {},
1865
- "outputs": [],
1866
- "source": [
1867
- "# include only specified fields\n",
1868
- "r = client.retrieve_by_specid(specid_list=specids_any, include=['sparcl_id','flux','redshift'])\n",
1869
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1870
- ]
1871
- },
1872
- {
1873
- "cell_type": "code",
1874
- "execution_count": null,
1875
- "metadata": {},
1876
- "outputs": [],
1877
- "source": [
1878
- "# include aux fields in SDSS-DR16 only\n",
1879
- "r = client.retrieve_by_specid(specid_list=specids_sdss, include=['vdisp','run2d'], dataset_list=['SDSS-DR16'])\n",
1880
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1881
- ]
1882
- },
1883
- {
1884
- "cell_type": "code",
1885
- "execution_count": null,
1886
- "metadata": {},
1887
- "outputs": [],
1888
- "source": [
1889
- "# include aux fields in BOSS-DR16 only\n",
1890
- "r = client.retrieve_by_specid(specid_list=specids_boss, include=['fiberid','mjd'], dataset_list=['BOSS-DR16'])\n",
1891
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1892
- ]
1893
- },
1894
- {
1895
- "cell_type": "code",
1896
- "execution_count": null,
1897
- "metadata": {},
1898
- "outputs": [],
1899
- "source": [
1900
- "# include aux fields in DESI-EDR only\n",
1901
- "r = client.retrieve_by_specid(specid_list=specids_desi, include=['survey','sv_primary'], dataset_list=['DESI-EDR'])\n",
1902
- "print([set(r.records[i].keys()) for i in range(len(r.records))][0])"
1903
- ]
1904
- },
1905
- {
1906
- "cell_type": "code",
1907
- "execution_count": null,
1908
- "metadata": {},
1909
- "outputs": [],
1910
- "source": [
1911
- "# try to include fields that do not exist in the DB\n",
1912
- "try:\n",
1913
- " r = client.retrieve_by_specid(specid_list=specids_any, include=['sparcl_id','marigold'])\n",
1914
- " print([set(r.records[i].keys()) for i in range(len(r.records))][0])\n",
1915
- "except Exception as e:\n",
1916
- " print(e)"
1917
- ]
1918
- },
1919
- {
1920
- "cell_type": "markdown",
1921
- "metadata": {},
1922
- "source": [
1923
- "<a class=\"anchor\" id=\"missing\"></a>\n",
1924
- "## client.missing()"
1925
- ]
1926
- },
1927
- {
1928
- "cell_type": "code",
1929
- "execution_count": null,
1930
- "metadata": {},
1931
- "outputs": [],
1932
- "source": [
1933
- "client.missing?"
1934
- ]
1935
- },
1936
- {
1937
- "cell_type": "code",
1938
- "execution_count": null,
1939
- "metadata": {},
1940
- "outputs": [],
1941
- "source": [
1942
- "some_missing_ids = ids_any + ['00009f84-8acc-425b-87e1-0a819f11697c','00002f94-96b1-4f2d-8d1d-1a47a89fe105']"
1943
- ]
1944
- },
1945
- {
1946
- "cell_type": "markdown",
1947
- "metadata": {},
1948
- "source": [
1949
- "<a class=\"anchor\" id=\"missing_uuid_list\"></a>\n",
1950
- "### parameter to test: uuid_list"
1951
- ]
1952
- },
1953
- {
1954
- "cell_type": "code",
1955
- "execution_count": null,
1956
- "metadata": {},
1957
- "outputs": [],
1958
- "source": [
1959
- "client.missing(uuid_list=ids_any)"
1960
- ]
1961
- },
1962
- {
1963
- "cell_type": "code",
1964
- "execution_count": null,
1965
- "metadata": {},
1966
- "outputs": [],
1967
- "source": [
1968
- "# List of 60,000 ids -- produces error\n",
1969
- "#client.missing(uuid_list=ids_lots)"
1970
- ]
1971
- },
1972
- {
1973
- "cell_type": "code",
1974
- "execution_count": null,
1975
- "metadata": {},
1976
- "outputs": [],
1977
- "source": [
1978
- "# 2 ids not in any datasets\n",
1979
- "client.missing(uuid_list=some_missing_ids)"
1980
- ]
1981
- },
1982
- {
1983
- "cell_type": "markdown",
1984
- "metadata": {},
1985
- "source": [
1986
- "<a class=\"anchor\" id=\"missing_dataset_list\"></a>\n",
1987
- "### parameter to test: dataset_list BUG??"
1988
- ]
1989
- },
1990
- {
1991
- "cell_type": "code",
1992
- "execution_count": null,
1993
- "metadata": {},
1994
- "outputs": [],
1995
- "source": [
1996
- "# ids only in DESI-EDR\n",
1997
- "client.missing(uuid_list=ids_desi, dataset_list=['SDSS-DR16','BOSS-DR16'])"
1998
- ]
1999
- },
2000
- {
2001
- "cell_type": "code",
2002
- "execution_count": null,
2003
- "metadata": {},
2004
- "outputs": [],
2005
- "source": [
2006
- "# ids only in SDSS-DR16\n",
2007
- "client.missing(uuid_list=ids_sdss, dataset_list=['DESI-EDR','BOSS-DR16'])"
2008
- ]
2009
- },
2010
- {
2011
- "cell_type": "code",
2012
- "execution_count": null,
2013
- "metadata": {},
2014
- "outputs": [],
2015
- "source": [
2016
- "# ids only in BOSS-DR16\n",
2017
- "client.missing(uuid_list=ids_boss, dataset_list=['DESI-EDR','SDSS-DR16'])"
2018
- ]
2019
- },
2020
- {
2021
- "cell_type": "markdown",
2022
- "metadata": {},
2023
- "source": [
2024
- "<a class=\"anchor\" id=\"missing_countOnly\"></a>\n",
2025
- "### parameter to test: countOnly BUG???"
2026
- ]
2027
- },
2028
- {
2029
- "cell_type": "code",
2030
- "execution_count": null,
2031
- "metadata": {},
2032
- "outputs": [],
2033
- "source": [
2034
- "client.missing(uuid_list=some_missing_ids,countOnly=True)"
2035
- ]
2036
- },
2037
- {
2038
- "cell_type": "markdown",
2039
- "metadata": {},
2040
- "source": [
2041
- "<a class=\"anchor\" id=\"missing_specids\"></a>\n",
2042
- "## client.missing_specids()"
2043
- ]
2044
- },
2045
- {
2046
- "cell_type": "code",
2047
- "execution_count": null,
2048
- "metadata": {},
2049
- "outputs": [],
2050
- "source": [
2051
- "client.missing_specids?"
2052
- ]
2053
- },
2054
- {
2055
- "cell_type": "code",
2056
- "execution_count": null,
2057
- "metadata": {},
2058
- "outputs": [],
2059
- "source": [
2060
- "some_missing_specids = specids_any + [11111111111111111, 999999999999999999]"
2061
- ]
2062
- },
2063
- {
2064
- "cell_type": "markdown",
2065
- "metadata": {},
2066
- "source": [
2067
- "<a class=\"anchor\" id=\"missing_specids_specid_list\"></a>\n",
2068
- "### parameter to test: specid_list"
2069
- ]
2070
- },
2071
- {
2072
- "cell_type": "code",
2073
- "execution_count": null,
2074
- "metadata": {},
2075
- "outputs": [],
2076
- "source": [
2077
- "client.missing_specids(specid_list=specids_any)"
2078
- ]
2079
- },
2080
- {
2081
- "cell_type": "code",
2082
- "execution_count": null,
2083
- "metadata": {},
2084
- "outputs": [],
2085
- "source": [
2086
- "# List of 60,000 specids -- produces error\n",
2087
- "#client.missing_specids(specid_list=specids_lots)"
2088
- ]
2089
- },
2090
- {
2091
- "cell_type": "code",
2092
- "execution_count": null,
2093
- "metadata": {},
2094
- "outputs": [],
2095
- "source": [
2096
- "# 2 specids not in any datasets\n",
2097
- "client.missing_specids(specid_list=some_missing_specids)"
2098
- ]
2099
- },
2100
- {
2101
- "cell_type": "markdown",
2102
- "metadata": {},
2103
- "source": [
2104
- "<a class=\"anchor\" id=\"missing_specids_dataset_list\"></a>\n",
2105
- "### parameter to test: dataset_list BUG??"
2106
- ]
2107
- },
2108
- {
2109
- "cell_type": "code",
2110
- "execution_count": null,
2111
- "metadata": {},
2112
- "outputs": [],
2113
- "source": [
2114
- "# specids only in DESI-EDR\n",
2115
- "client.missing_specids(specid_list=specids_desi, dataset_list=['SDSS-DR16','BOSS-DR16'])"
2116
- ]
2117
- },
2118
- {
2119
- "cell_type": "code",
2120
- "execution_count": null,
2121
- "metadata": {},
2122
- "outputs": [],
2123
- "source": [
2124
- "# specids only in SDSS-DR16\n",
2125
- "client.missing_specids(specid_list=specids_sdss, dataset_list=['DESI-EDR','BOSS-DR16'])"
2126
- ]
2127
- },
2128
- {
2129
- "cell_type": "code",
2130
- "execution_count": null,
2131
- "metadata": {},
2132
- "outputs": [],
2133
- "source": [
2134
- "# specids only in BOSS-DR16\n",
2135
- "client.missing_specids(specid_list=specids_boss, dataset_list=['DESI-EDR','SDSS-DR16'])"
2136
- ]
2137
- },
2138
- {
2139
- "cell_type": "markdown",
2140
- "metadata": {},
2141
- "source": [
2142
- "<a class=\"anchor\" id=\"missing_specids_countOnly\"></a>\n",
2143
- "### parameter to test: countOnly BUG???"
2144
- ]
2145
- },
2146
- {
2147
- "cell_type": "code",
2148
- "execution_count": null,
2149
- "metadata": {},
2150
- "outputs": [],
2151
- "source": [
2152
- "client.missing_specids(specid_list=some_missing_specids,countOnly=True)"
2153
- ]
2154
- }
2155
- ],
2156
- "metadata": {
2157
- "kernelspec": {
2158
- "display_name": "Python 3 (ipykernel)",
2159
- "language": "python",
2160
- "name": "python3"
2161
- },
2162
- "language_info": {
2163
- "codemirror_mode": {
2164
- "name": "ipython",
2165
- "version": 3
2166
- },
2167
- "file_extension": ".py",
2168
- "mimetype": "text/x-python",
2169
- "name": "python",
2170
- "nbconvert_exporter": "python",
2171
- "pygments_lexer": "ipython3",
2172
- "version": "3.10.12"
2173
- }
2174
- },
2175
- "nbformat": 4,
2176
- "nbformat_minor": 4
2177
- }