|
569 | 569 | "\n", |
570 | 570 | "The TAP service is the recommended way to retrieve DP0.1 catalog data for a notebook, and there are several other tutuorials that demonstrate how to use the TAP service.\n", |
571 | 571 | "\n", |
572 | | - "But if Butler access to catalog data is needed, start by retrieving only the schema of a Butler catalog.\n", |
573 | | - "Unlike with TAP schema (as in the first tutorial notebook), the Butler schema do not come with embedded column descriptions. Refer to the DP0.1 Data Products Definitions Document (DPDD) at [dp0-1.lsst.io](http://dp0-1.lsst.io) to find out more about the columns." |
| 572 | + "But if Butler access to catalog data is needed, an easy way to start is by retrieving only the schema data set for a Butler catalog, which can be done without specifying the ``dataId``. " |
574 | 573 | ] |
575 | 574 | }, |
576 | 575 | { |
|
583 | 582 | "schema_coadd_src.asAstropy()" |
584 | 583 | ] |
585 | 584 | }, |
| 585 | + { |
| 586 | + "cell_type": "markdown", |
| 587 | + "metadata": {}, |
| 588 | + "source": [ |
| 589 | + "Each of the following lines will print the schema to the screen in different ways." |
| 590 | + ] |
| 591 | + }, |
| 592 | + { |
| 593 | + "cell_type": "code", |
| 594 | + "execution_count": null, |
| 595 | + "metadata": {}, |
| 596 | + "outputs": [], |
| 597 | + "source": [ |
| 598 | + "# schema_coadd_src.schema\n", |
| 599 | + "# schema_coadd_src.schema.getNames()\n", |
| 600 | + "# schema_coadd_src.schema.getOrderedNames()\n", |
| 601 | + "print('Number of columns in this table = ', len(schema_coadd_src.schema.getNames()) )" |
| 602 | + ] |
| 603 | + }, |
| 604 | + { |
| 605 | + "cell_type": "markdown", |
| 606 | + "metadata": {}, |
| 607 | + "source": [ |
| 608 | + "Perhaps you want to search for all schema elements that contain the term 'psf'." |
| 609 | + ] |
| 610 | + }, |
| 611 | + { |
| 612 | + "cell_type": "code", |
| 613 | + "execution_count": null, |
| 614 | + "metadata": {}, |
| 615 | + "outputs": [], |
| 616 | + "source": [ |
| 617 | + "# Define an array that is all of the column names\n", |
| 618 | + "all_names = schema_coadd_src.schema.getOrderedNames()\n", |
| 619 | + "\n", |
| 620 | + "# Loop over the names and look for the term 'psf'\n", |
| 621 | + "for i,name in enumerate(all_names):\n", |
| 622 | + " if name.find('psf') >= 0:\n", |
| 623 | + " print( i, name )\n", |
| 624 | + "del all_names" |
| 625 | + ] |
| 626 | + }, |
| 627 | + { |
| 628 | + "cell_type": "markdown", |
| 629 | + "metadata": {}, |
| 630 | + "source": [ |
| 631 | + "Probably you will want to know more about the values in these columns. You can do that by printing the documentation string in the schema." |
| 632 | + ] |
| 633 | + }, |
| 634 | + { |
| 635 | + "cell_type": "code", |
| 636 | + "execution_count": null, |
| 637 | + "metadata": {}, |
| 638 | + "outputs": [], |
| 639 | + "source": [ |
| 640 | + "# Turn the schema into a python dictionary, to be able to call a column by name\n", |
| 641 | + "schema_dict = schema_coadd_src.schema.extract('*')\n", |
| 642 | + "\n", |
| 643 | + "# Print the associated docstring for each of the named columns of interest\n", |
| 644 | + "for name in ['base_SdssShape_psf_xx','base_SdssShape_psf_yy','base_SdssShape_psf_xy']:\n", |
| 645 | + " doc = schema_dict[name].getField().getDoc()\n", |
| 646 | + " print(name, ' = ', doc)" |
| 647 | + ] |
| 648 | + }, |
| 649 | + { |
| 650 | + "cell_type": "markdown", |
| 651 | + "metadata": {}, |
| 652 | + "source": [ |
| 653 | + "Refer to the DP0.1 Data Products Definitions Document (DPDD) at [dp0-1.lsst.io](http://dp0-1.lsst.io) to find out more about the columns." |
| 654 | + ] |
| 655 | + }, |
586 | 656 | { |
587 | 657 | "cell_type": "markdown", |
588 | 658 | "metadata": {}, |
|
0 commit comments