{"id":394,"date":"2018-05-31T18:16:55","date_gmt":"2018-05-31T16:16:55","guid":{"rendered":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/?page_id=394"},"modified":"2021-12-09T21:05:01","modified_gmt":"2021-12-09T19:05:01","slug":"sdss-sample-of-galaxies","status":"publish","type":"page","link":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/the-course\/sdss-sample-of-galaxies\/","title":{"rendered":"SDSS sample of galaxies"},"content":{"rendered":"<h2>Exercise with a list of SDSS galaxies<\/h2>\n<p>We assume that the <tt>abell2065_2deg_radius.csv<\/tt> file is in <tt>~\/mpe2018\/Data<\/tt> otherwise change the file path as appropriate. Can download it <a href=\"\/imprs-db\/Data\/abell2065_2deg_radius.csv\">from here<\/a>.<br \/>\nYou can download any additional data set querying the <a href=\"https:\/\/skyserver.sdss.org\/dr14\/en\/tools\/search\/form\/searchform.aspx\" rel=\"noopener\" target=\"_blank\">SDSS Skyserver<\/a>.<br \/>\nColumns description:<\/p>\n<pre>\r\n<strong>objid<\/strong>      => unique identifier (numeric) of the object\r\n<strong>rad<\/strong>        => Right Ascension (fractional degrees)\r\n<strong>decd<\/strong>       => Declination (fractional degrees)\r\n<strong>u g r i z<\/strong>  => magnitude of the object in these filters\r\n<strong>redshift<\/strong>   => z\r\n<strong>specobjid<\/strong>  => unique spectrum ID\r\n<\/pre>\n<p>As usual, the <tt>mysql><\/tt> prompt is omitted. The database is always <tt>mpe2018db<\/tt>.<br \/>\nHave a look to the file with a text editor, or e.g. just<br \/>\n<code>head -5 ~\/mpe2018\/Data\/abell2065_2deg_radius.csv<\/code><\/p>\n<p>Manually create the table to host the catalogue:<\/p>\n<pre>\r\nuse mpe2018db;\r\n\r\nCREATE TABLE sdss_sample (\r\n  objid bigint NOT NULL,\r\n  rad   double NOT NULL,\r\n  decd  double NOT NULL,\r\n  u     float DEFAULT NULL,\r\n  g     float DEFAULT NULL,\r\n  r     float DEFAULT NULL,\r\n  i     float DEFAULT NULL,\r\n  z     float DEFAULT NULL,\r\n  redshift float DEFAULT NULL,\r\n  specobjid bigint NOT NULL\r\n) engine=MyISAM;\r\n<\/pre>\n<p>Load the CSV file into the table via <tt>LOAD DATA<\/tt> (we use explicit clauses for clarity &#8211; see the <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/load-data.html\" rel=\"noopener\" target=\"_blank\">MySQL reference page<\/a>), describe the content, count the number of rows (galaxies) in the catalogue, print the first five rows:<\/p>\n<pre>\r\nload data local infile '~\/mpe2018\/Data\/abell2065_2deg_radius.csv'\r\n  into table sdss_sample\r\n  FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\\\'\r\n  LINES TERMINATED BY '\\n' STARTING BY ''\r\n  IGNORE 2 LINES;\r\n\r\ndescribe sdss_sample;\r\n\r\nselect count(*) from sdss_sample;\r\nselect * from sdss_sample limit 5;\r\n<\/pre>\n<p>Let&#8217;s preform some queries. Here we investigate the extreme redshift ranges.<\/p>\n<pre>\r\nselect * from sdss_sample where redshift > 3.;\r\n-- 3 found\r\nselect * from sdss_sample where redshift > 1. and redshift < 3;\r\n-- 7 found\r\nselect * from sdss_sample where redshift < 0.00001;\r\n-- 4 found\r\n\r\nselect objid, r, u-r as color from sdss_sample order by color asc limit 3; \r\nselect objid, r, u-r as color from sdss_sample order by color desc limit 3; \r\nselect objid, r, g-r as color from sdss_sample order by color desc limit 3; \r\n<\/pre>\n<p>Exercise with more queries of your choice. I suggest to perform queries to identify the number of objects in <tt>r<\/tt> magnitude ranges and <tt>(g - r)<\/tt> color. We'll see these data in a graphical way too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exercise with a list of SDSS galaxies We assume that the abell2065_2deg_radius.csv file is in ~\/mpe2018\/Data otherwise change the file path as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":16,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-394","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/pages\/394"}],"collection":[{"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/comments?post=394"}],"version-history":[{"count":0,"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/pages\/394\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/pages\/16"}],"wp:attachment":[{"href":"https:\/\/ross2.oas.inaf.it\/wp\/imprs18\/wp-json\/wp\/v2\/media?parent=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}