en:praktikum:sternspektren_baches

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:sternspektren_baches [2023/07/21 21:11] – [Radial velocity determination] rhainichen:praktikum:sternspektren_baches [2024/03/20 09:29] (current) – [Plotting the spectrum] rhainich
Line 42: Line 42:
       Flatdarks/       Flatdarks/
       ...       ...
 +
 +<color #ed1c24>**Note:**</color> **This folder structure is essential for some data reduction steps. It is therefore essential that the files are sorted accordingly!**
  
 There are different tools to view the FITS files (two dimensional CCD images or data tables). //ds9// is easy to handle and can be started from the terminal via: There are different tools to view the FITS files (two dimensional CCD images or data tables). //ds9// is easy to handle and can be started from the terminal via:
Line 58: Line 60:
 ===== Data reduction ===== ===== Data reduction =====
  
-The scripts for the evaluation can be found on the [[en:praktikum: zugang| lab course computer]] in the folder ''~/scripts/n1_baches''. Copy the script ''1_masterimages.py'' into the local directory where you want to analyze the star (e.g. ''Star_1''). This script will create among other files the masterdark and the masterflat needed in the following processing steps. Furthermore, this script stacks all star images, if more than one was taken during the observations. It also offers the possibility to bin the observed images, if this was not done during the observation. It also cuts not needed parts of the captured images. This simplifies the further analysis steps. Last but not least, you should specify in this script if the exposures have to be mirrored (see previous step), so that this can be corrected as well. The configuration area of the script looks like this:+=== Install the pipeline === 
 + 
 +Some modules from the OST photometry pipeline are required for the data reduction. Python modules should always be installed in a virtual environment to reduce dependency issues. A virtual environment can be created using 
 + 
 +   mkvirtualenv ost_photometry 
 + 
 +By doing so, we have named the virtual environment ''ost_photometry''. The fact that we are in the virtual environment is indicated by the string '(ost_photometry)', which now precedes each terminal line. To leave the virtual environment, simply type 
 + 
 +   deactivate 
 + 
 +If you want to reconnect, you can do so by typing 
 + 
 +   workon ost_photometry  
 + 
 +This is also necessary if you reconnect to a12, e.g. after a break, and want to continue the data analysis.  
 + 
 +The OST photometry pipeline can then be installed in the terminal using //pip// as follows 
 + 
 +   pip install ost_photometry 
 + 
 +All necessary dependencies are also installed in this way.  
 + 
 + 
 +=== Reduce the data === 
 + 
 +The scripts for the data reduction can be found on the [[en:praktikum: zugang| lab course computer]] in the folder ''~/scripts/n1_baches''. Copy the script ''1_masterimages.py'' into the local directory where you want to analyze the star (e.g. ''Star_1''). This script will create among other files the masterdark and the masterflat needed in the following processing steps. Furthermore, this script stacks all star images, if more than one was taken during the observations. It also offers the possibility to bin the observed images, if this was not done during the observation. It also cuts not needed parts of the captured images. This simplifies the further analysis steps. Last but not least, you should specify in this script if the exposures have to be mirrored (see previous step), so that this can be corrected as well. The configuration area of the script looks like this:
  
    ############################################################################    ############################################################################
Line 77: Line 104:
        
    #   Thorium Argon exposures:    #   Thorium Argon exposures:
-   path_thars = '?'+   path_thorium_argon = '?'
        
    #   Spectra:    #   Spectra:
Line 89: Line 116:
    #   Flip images? Possibilities: True and False    #   Flip images? Possibilities: True and False
    #    #
-   flip_bool = False+   flip_images = False
        
    ###    ###
    #   Bin the images? Possibilities: True and False    #   Bin the images? Possibilities: True and False
    #    #
-   bin_bool = False+   bin_images = False
        
    #   Binning factor    #   Binning factor
-   bin_val = 2+   binning_value = 2
        
    ###    ###
Line 103: Line 130:
    #   Possibilities: True and False; Default: True    #   Possibilities: True and False; Default: True
    #    #
-   trim_bool = True+   trim_image = True
  
-In ''path_darks'', ''path_flat_darks'', ''path_flats'', ''path_thars'' and ''path_spectra'' the corresponding subfolders are to be entered, which were created in section //Preparations//. ''out_path'' is the directory where the script places intermediate results. The reduced files (**master_dark.fit**, **master_flat.fit**, **master_thar.fit**, **master_spectrum.fit**) are stored in the local directory so that they are more easily available for the following analysis steps. +In ''path_darks'', ''path_flat_darks'', ''path_flats'', ''path_thorium_argon'' and ''path_spectra'' the corresponding subfolders are to be entered, which were created in section //Preparations//. ''out_path'' is the directory where the script places intermediate results. The reduced files (**master_dark.fit**, **master_flat.fit**, **master_thar.fit**, **master_spectrum.fit**) are stored in the local directory so that they are more easily available for the following analysis steps. 
  
-If you want to mirror the recordings you have to set ''flip_bool'' to ''True''. If the images should also be binned, set ''bin_bool'' to ''True''. The binning factor can be determined via the variable ''bin_val''.+If you want to mirror the recordings you have to set ''flip_images'' to ''True''. If the images should also be binned, set ''bin_images'' to ''True''. The binning factor can be determined via the variable ''binning_value''.
  
 +**Important:** When the data reduction is finished, disable the virtual environment with
 +
 +   deactivate
  
 ===== Data analysis ===== ===== Data analysis =====
Line 201: Line 231:
 In this case, the script should be stopped by entering a ''2''. Afterwards the script can be restarted with a reduced number of orders, e.g.: In this case, the script should be stopped by entering a ''2''. Afterwards the script can be restarted with a reduced number of orders, e.g.:
  
-   calibrate/baches flat.fit thar.fit 23 20 20+   calibrate/baches master_flat.fit master_thar.fit 23 20 20
  
-A solid method is to gradually reduce the number of orders until the script executed successfully. Afterwards, the flatfield with the identified orders will be displayed in an external window (see below). It should be checked whether the marks of the orders are horizontal and whether they coincide with the actual orders that are visible on the flatfield. The left figure shows a successful test run, whereas the middle figure depicts a failure. The right figure shows a flatfield image taken with the QHY268M, where it can happen that //MIDAS// does not finish drawing all identified orders. From the order numbers, however, it can be assessed if all orders were successfully identified or not. +A solid method is to gradually reduce the number of orders until the script executed successfully. Afterwards, the flatfield with the identified orders will be displayed in an external window (see below). It should be checked whether the marks of the orders are horizontal and whether they coincide with the actual orders that are visible on the flatfield. The left figure shows a successful test run, whereas the middle figure depicts a failure. The right figure shows a flatfield image taken with the QHY268M, where it can happen that //MIDAS// does not finish drawing all identified orders. From the order numbers, however, it can be assessed if all orders were successfully identified or not. The numbers also depend on whether the images are binned. As we usually use 2x2 binning, the above values should suffice. In case we have used 1x1 binning for the spectra however, you might have to double the second and third value.
  
 <WRAP group> <WRAP group>
Line 418: Line 448:
 For this purpose, suitable spectral lines must be selected whose rest wavelengths are known. For this purpose, suitable spectral lines must be selected whose rest wavelengths are known.
  
-**Please note:** If difficulties arise during the line selection, it can be helpful to look at a hydrogen line for a first estimation. However, since these lines are often very broad, the radial velocity determined in this way will usually not be very accurate. Another pair of lines suitable in many cases would also be seen by pointing the spectrograph at street lamps, although these types of lamps are becoming increasingly rare. Alternatively, you can jump to the [[en:praktikum:sternspektren_baches#Plotting the spectrum | Plotting the spectrum]] section and look at the spectrum divided into smaller sections. This way you may already get a better impression of the potential spectral type and potentially suitable spectral lines.+**Please note:** If difficulties arise during the line selection, it can be helpful to look at a hydrogen lines for a first estimation. However, since these lines are often very broad, the radial velocity determined in this way will usually not be very accurate. Another pair of lines suitable in many cases would also be seen by pointing the spectrograph at street lamps, although these types of lamps are becoming increasingly rare. Alternatively, you can jump to the [[en:praktikum:sternspektren_baches#Plotting the spectrum | Plotting the spectrum]] section and look at the spectrum divided into smaller sections. This way you may already get a better impression of the potential spectral type and potentially suitable spectral lines.
  
 The central wavelength must now be determined for the selected lines. To achieve this, the line can be fitted with a Gaussian function:  The central wavelength must now be determined for the selected lines. To achieve this, the line can be fitted with a Gaussian function: 
    center/gauss gcursor,2 ? absorption    center/gauss gcursor,2 ? absorption
-To do the fit of the function click left and right of the absorption line with the left mouse button, to quit press the right mouse button. In the terminal you will find the fit parameters like "CENTER" (central wavelength of the line core) or "FWHM" (Full Width at Half Maximum), which gives you the width of the Gaussian function. Re-do the measurement several times to be sure to set good limits for the Gaussian fit and to get a feeling of the error in the measurement. This should be done for at least five single absorption lines. Do you see a difference in the accuracy of the measurent of the central wavelength of different lines? Discuss the reason in the report. With the help of the Doppler formula you can then calculate the relative velocity of the star from the shift of the central wavelength of the absorption lines in respective to their rest wavelength. The rest wavelength can be determined via the [[https://physics.nist.gov/PhysRefData/ASD/lines_form.html | NIST database ]]. Of course, we also have a [[en:praktikum:nist|tutorial]] for this. +To do the fit of the function click left and right of the absorption line with the left mouse button, to quit press the right mouse button. In the terminal you will find the fit parameters like "CENTER" (central wavelength of the line core) or "FWHM" (Full Width at Half Maximum), which gives you the width of the Gaussian function. Re-do the measurement several times to be sure to set good limits for the Gaussian fit and to get a feeling of the error in the measurement. This should be done for at least five single absorption lines. Do you see a difference in the accuracy of the measurent of the central wavelength of different lines? Discuss the reason in the report. With the help of the Doppler formula you can then calculate the relative velocity of the star from the shift of the central wavelength of the absorption lines in respective to their rest wavelength. The rest wavelength can be determined via the [[https://physics.nist.gov/PhysRefData/ASD/lines_form.html | NIST database]]. Of course, we also have a [[en:praktikum:nist|tutorial]] for this. 
  
 === Barycentric correction === === Barycentric correction ===
Line 456: Line 486:
  
 {{section>deng:praktikum:a12:python#English&noheader}} {{section>deng:praktikum:a12:python#English&noheader}}
 +
 +**Important:** Make sure that the virtual environment we used for data reduction is disabled before proceeding:
 +
 +   deactivate
  
 The spectrum should be plotted by means of the python script ''3_printmasterplot.py'', which can be found in the following directory ''~/scripts/n1_baches/''. This script can extract both the total spectrum created by //MIDAS// and the individual spectra of the various orders from the FITS files and then display them.  The spectrum should be plotted by means of the python script ''3_printmasterplot.py'', which can be found in the following directory ''~/scripts/n1_baches/''. This script can extract both the total spectrum created by //MIDAS// and the individual spectra of the various orders from the FITS files and then display them. 
Line 463: Line 497:
 |< 100% - >| |< 100% - >|
 ^ Variable ^ Description  ^ ^ Variable ^ Description  ^
-| ''File_orders'' | Name of the FITS file created with //MIDAS// which contains the individual orders (usually master_spectrum_wr.fit). | +| ''file_with_orders'' | Name of the FITS file created with //MIDAS// which contains the individual orders (usually master_spectrum_wr.fit). | 
-| ''File_merged'' | Name of the FITS file created with //MIDAS// which contains the merged spectrum (usually master_spectrum_wrm.fit). | +| ''file_with_merged_spectrum'' | Name of the FITS file created with //MIDAS// which contains the merged spectrum (usually master_spectrum_wrm.fit). | 
-| ''objectname'' | Name of the object |+| ''object_name'' | Name of the object |
 | ''radial_velocity'' | Measured radial velocity in km/s (without barycentric correction) | | ''radial_velocity'' | Measured radial velocity in km/s (without barycentric correction) |
 | ''ions'' | Ions to be considered for line identification | | ''ions'' | Ions to be considered for line identification |
 | ''manual_lines'' | By means of this variable further line identifications can be added manually. An identification string such as "HeI", the wavelength and the alignment parameter ("center", "left" or "right") must be set for each line. | | ''manual_lines'' | By means of this variable further line identifications can be added manually. An identification string such as "HeI", the wavelength and the alignment parameter ("center", "left" or "right") must be set for each line. |
-| ''line_lower_continuum'' | This variable determines how deep lines must be in comparison to the continuum so that line identifications are displayed for the corresponding lines. The higher this value, the fewer line identifications are displayed, since only the stronger lines then fulfill this criterion. **Note:** If the radial velocity is wrong and a value greater than zero is set here, then the line identification often does not work. Therefore this variable should be set to zero if the radial velocity is unknown. |+| ''percentage_line_flux_must_be_below_continuum'' | This variable determines how deep lines must be in comparison to the continuum so that line identifications are displayed for the corresponding lines. The higher this value, the fewer line identifications are displayed, since only the stronger lines then fulfill this criterion. **Note:** If the radial velocity is wrong and a value greater than zero is set here, then the line identification often does not work. Therefore this variable should be set to zero if the radial velocity is unknown. |
  
  
Line 477: Line 511:
        
    #   Name of file with individual orders    #   Name of file with individual orders
-   File_orders = "master_spectrum_wr.fit"+   file_with_orders = "master_spectrum_wr.fit"
        
    #   Name of file with merged spectrum    #   Name of file with merged spectrum
-   File_merged = "master_spectrum_wrm.fit"+   file_with_merged_spectrum = "master_spectrum_wrm.fit"
        
    #   Name of the object    #   Name of the object
-   objectname = "?"+   object_name = "?"
        
              
Line 506: Line 540:
        
    #   Percent the line flux must be lower than the continuum    #   Percent the line flux must be lower than the continuum
-   line_lower_continuum = 3.+   percentage_line_flux_must_be_below_continuum = 3.
  
 By default, the script creates two PDF files: ''spectrum_panels_MIDAS-merged_<objectname>.pdf'' and ''spectrum_total_MIDAS-merged_<objectname>.pdf''. The file with ''total'' in its name displays the spectrum in a single plot. Due to the large spectral range in this plot, details are often hard to see. Therefore, the second file (with ''panels'' in the name) shows the respective spectrum distributed over several "panels", which in turn makes the identification of individual lines much easier.  By default, the script creates two PDF files: ''spectrum_panels_MIDAS-merged_<objectname>.pdf'' and ''spectrum_total_MIDAS-merged_<objectname>.pdf''. The file with ''total'' in its name displays the spectrum in a single plot. Due to the large spectral range in this plot, details are often hard to see. Therefore, the second file (with ''panels'' in the name) shows the respective spectrum distributed over several "panels", which in turn makes the identification of individual lines much easier. 
Line 515: Line 549:
 === Identification of the spectral lines === === Identification of the spectral lines ===
  
-The **ions** that are to be identified via the line identifications **must be specified in the variable** ''ions''. **If this is not done, no line identifications will be displayed!** The script reads the line information from the file ''atomic_lines.tsv''. **But since this file contains only a selection of spectral lines**, which are found in the many different stars, **it is necessary to search for additional spectral lines** and their transitions, e.g., in the [[http://physics.nist.gov/PhysRefData/ASD/index.html|NIST data base]] as already mentioned, we also have a [[en:praktikum:nist|tutorial]] for this database. The extracted line information must then be entered into the variable ''manual_lines''+The **ions** that are to be identified via the line identifications **must be specified in the variable** ''ions''. **If this is not done, no line identifications will be displayed!** The script reads the line information from the file ''atomic_lines.tsv''. **But since this file contains only a selection of spectral lines**, which are found in the many different stars, **it is necessary to search for additional spectral lines** and their transitions, e.g., in the [[http://physics.nist.gov/PhysRefData/ASD/index.html|NIST data base]] as already mentioned, we also have a [[en:praktikum:nist|tutorial]] for this database. The extracted line information need to be entered into the variable ''manual_lines''
  
 === Determination of the spectral type === === Determination of the spectral type ===
  • en/praktikum/sternspektren_baches.1689973901.txt.gz
  • Last modified: 2023/07/21 21:11
  • by rhainich