en:praktikum:photometrie_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:praktikum:photometrie_python [2024/10/09 08:09] – Adjusts name of laboratory computer rhainichen:praktikum:photometrie_python [2025/04/01 11:16] (current) – [Defining some variables] rhainich
Line 170: Line 170:
 Note: The variable names given here and in the following are only examples and can be replaced by any other name.   Note: The variable names given here and in the following are only examples and can be replaced by any other name.  
  
-Note: If the images are not in a subdirectory of the current directory, the path can also refer to the next higher level by means of ''../''.+Note: If the images are not in a subdirectory of the current directory, the path can also refer to the next higher level by using ''../''.
  
 ==== Reading in the images ==== ==== Reading in the images ====
Line 211: Line 211:
 === Finding the stars === === Finding the stars ===
  
-The identification of the stars in the two images is performed using the ''main_extract'' function. This function takes as the first argument the ''image'' object. The second argument characterizes the size of the diffraction discs. This so called sigma can be determined from the images. But it is usually around ''3.0''. As an optional argument, the extraction method can be selected (''photometry''). Here we specify '''APER''', and thus select aperture photometry, where the flux of the individual objects and the associated sky backgrounds is read out within fixed apertures (here circular and ring-shaped, respectively). To specify these apertures, we have to give a radius for the circular object aperture (''rstars'') and two radii for the annular background aperture (''rbg_in'' and ''rbg_out''). In previous observations, the respective values were ''4'', ''7'', and ''10'', respectively. The radii are in arc seconds. +The identification of the stars in the two images is performed using the ''main_extract'' function. This function takes as the first argument the ''image'' object. As an optional argument, the extraction method can be selected (''photometry''). Here we specify '''APER''', and thus select aperture photometry, where the flux of the individual objects and the associated sky backgrounds is read out within fixed apertures (here circular and ring-shaped, respectively). To specify these apertures, we have to give a radius for the circular object aperture (''rstars'') and two radii for the annular background aperture (''rbg_in'' and ''rbg_out''). In previous observations, the respective values were ''4'', ''7'', and ''10'', respectively. The radii are in arc seconds. 
  
    #   Extract objects    #   Extract objects
    main_extract(    main_extract(
        V_image,        V_image,
-       sigma, 
        photometry_extraction_method='APER',        photometry_extraction_method='APER',
        radius_aperture=4.,        radius_aperture=4.,
Line 224: Line 223:
    main_extract(    main_extract(
        B_image,        B_image,
-       sigma, 
        photometry_extraction_method='APER',        photometry_extraction_method='APER',
        radius_aperture=4.,        radius_aperture=4.,
Line 321: Line 319:
 In the next step we can perform the actual download. For this purpose we use the function ''.query_region''. We have to pass to it the coordinates and the size of the sky region to be queried. Fortunately, both are already known. We know the coordinates from the FIT headers of the star cluster images and the radius of the region is simply the field of view, which we already calculated above. Both values can be taken from the ''V_image'' object. In the next step we can perform the actual download. For this purpose we use the function ''.query_region''. We have to pass to it the coordinates and the size of the sky region to be queried. Fortunately, both are already known. We know the coordinates from the FIT headers of the star cluster images and the radius of the region is simply the field of view, which we already calculated above. Both values can be taken from the ''V_image'' object.
  
-   calib_tbl = v.query_region(V_image.coord, radius=V_image.fov*u.arcmin)[0]+   calib_tbl = v.query_region(V_image.V_image.coordinates_image_center, radius=V_image.field_of_view_x*u.arcmin)[0]
  
 The table ''calib_tbl'' now comprise all objects contained in the **APASS** catalog that are in our field of view with their ''B'' and ''V'' magnitudes. The table ''calib_tbl'' now comprise all objects contained in the **APASS** catalog that are in our field of view with their ''B'' and ''V'' magnitudes.
Line 394: Line 392:
 One way to check the validity of the calibration stars is to display them on a starmap (similar to what the ''main_extract'' above does automatically). But now we want to display the downloaded star positions as well as the stars that were actually used for the calibration later on. For this purpose the OST library offers a suitable function (''starmap'') which can create such plots. This function can be loaded via  One way to check the validity of the calibration stars is to display them on a starmap (similar to what the ''main_extract'' above does automatically). But now we want to display the downloaded star positions as well as the stars that were actually used for the calibration later on. For this purpose the OST library offers a suitable function (''starmap'') which can create such plots. This function can be loaded via 
  
-   from ost.analyze.plot import starmap+   from ost_photometry.analyze.plots import starmap
  
 Since this function expects as input an astropy table, with the data to be plotted, we must first create it before we can plot the starmap. The position of the calibration stars are not yet available in pixel coordinates, because we got this information from the Simbad or Vizier database. Therefore, we need to generate these. At this point it is convenient that we have previously created a ''SkyCoord'' object for these stars. Using ''.to_pixel()'' and specifying the WCS of the image, we can easily generate pixel coordinates: Since this function expects as input an astropy table, with the data to be plotted, we must first create it before we can plot the starmap. The position of the calibration stars are not yet available in pixel coordinates, because we got this information from the Simbad or Vizier database. Therefore, we need to generate these. At this point it is convenient that we have previously created a ''SkyCoord'' object for these stars. Using ''.to_pixel()'' and specifying the WCS of the image, we can easily generate pixel coordinates:
Line 442: Line 440:
 Then the actual image can be loaded: Then the actual image can be loaded:
  
-   plt.imshow(image, origin='lower')+   plt.imshow(V_image, origin='lower')
  
 ''image'' is the actual image data and ''origin=lower'' makes sure that the overplotting of the pixel coordinates works. Afterwards the symbols which mark the star position can be plotted: ''image'' is the actual image data and ''origin=lower'' makes sure that the overplotting of the pixel coordinates works. Afterwards the symbols which mark the star position can be plotted:
  • en/praktikum/photometrie_python.1728461391.txt.gz
  • Last modified: 2024/10/09 08:09
  • by rhainich