Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Other cookbook

Table of contents

  1. Convert x axis
  2. Convert y axis
  3. Shift to barycentric frame
  4. Shift to rest frame
  5. Shift from rest frame
  6. Import a data structure from a session into the current one
  7. Modify a data structure using a binary operator

Convert x axis

Method CookbookEdit.x_convert
Parameters
  • zem: Emission redshift
  • xunit: Unit of wavelength or velocity
JSON template
{
  "cookbook": "cb",
  "recipe": "x_convert",
  "params": {
    "zem": "0",
    "xunit": "km / s"
  }
}    

Convert the x axis to wavelength or velocity units. The x axis can be converted to any unit of wavelength or velocity (default: nm and km/s). The conversion applies to both the spectrum and the line list. When converting to and from velocity units, the zero point is set at (1+zem)λ_Lya (where λ_Lya = 121.567 nm is the rest-frame wavelength of the Lyman-alpha transition).

Convert y axis

Method CookbookEdit.y_convert
Parameters
  • yunit: Unit of flux density
JSON template
{
  "cookbook": "cb",
  "recipe": "y_convert",
  "params": {
    "yunit": "electron / nm"
  }
}    

Convert the y axis to different units. The y axis can be expressed in different units depending on how it was calibrated (default: erg/(cm^2 s nm)). It can be converted to any unit of the same physical quantity. The conversion applies to both the spectrum and the line list.

Shift to barycentric frame

Method CookbookEdit.shift_bary
Parameters
  • v: Velocity in the barycentric frame (km/s)
JSON template
{
  "cookbook": "cb",
  "recipe": "shift_bary",
  "params": {
    "v": "null"
  }
}    

Shift x axis to the barycentric frame of the solar system.

Shift to rest frame

Method CookbookEdit.shift_to_rf
Parameters
  • z: Redshift to use for shifting
JSON template
{
  "cookbook": "cb",
  "recipe": "shift_to_rf",
  "params": {
    "z": "0"
  }
}    

Shift x axis to the rest frame.

Shift from rest frame

Method CookbookEdit.shift_from_rf
Parameters
  • z: Redshift to use for shifting
JSON template
{
  "cookbook": "cb",
  "recipe": "shift_from_rf",
  "params": {
    "z": "0"
  }
}    

Shift x axis from rest frame to the original frame.

Import a data structure from a session into the current one

Method CookbookEdit.struct_import
Parameters
  • struct: Structure
  • mode: Mode (replace or append)
JSON template
{
  "cookbook": "cb",
  "recipe": "struct_import",
  "params": {
    "struct": "'0,systs'",
    "mode": "'replace'"
  }
}    

The structure to be imported is described by a string with the session number and the structure tag (spec, lines, systs), separated by a comma (e.g. 0,spec, meaning “spectrum from session 0”). The imported structure is either replaced or appended to the corresponding one in the current session.

Modify a data structure using a binary operator

Method CookbookEdit.struct_modify
Parameters
  • col: Output column
  • expr: Expression
JSON template
{
  "cookbook": "cb",
  "recipe": "struct_modify",
  "params": {
    "col": "''",
    "expr": "''"
  }
}    

Modify a data structure using a binary operator. An output column is computed from an expression with input columns as arguments. The expression must be parsable by AST, with columns described by a string with the session number, the structure tag (spec, lines, systs), and the column name separated by a comma (e.g. 0,spec,x, meaning “column x of spectrum from session 0”). Columns can be from different data structures only if they have the same length. If the output column already exists, it is overwritten.