PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v1.0.0-rc2 »
- SDSS Utilities (`pydl.pydlutils`) »
- sdss_specobjid

# sdss_specobjid

pydl.pydlutils.sdss.sdss_specobjid(plate, fiber, mjd, run2d, line=None, index=None)

  Convert SDSS spectrum identifiers into CAS-style specObjID.

  Bits are assigned in specObjID thus:

  Bits | Name | Comment
  --- | --- | ---
  50-63 | Plate ID | 14 bits
  38-49 | Fiber ID | 12 bits
  24-37 | MJD | Date plate was observed minus 50000 (14 bits)
  10-23 | run2d | Spectroscopic reduction version
  0-9 | line/index | 0 for use in SpecObj files see below for other uses (10 bits)

  Parameters
    plate, fiber, mjd `int` or array of int

      Plate, fiber ID, and MJD for a spectrum. If arrays are passed, all must have the same length. The MJD value must be greater than 50000.

    run2d `int`, `str` or array of int or str

      The run2d value must be an integer or a string of the form ‘vN_M_P’. If an array is passed, it must have the same length as the other inputs listed above. If the string form is used, the values are restricted to \(5 \le N \le 6\), \(0 \le M \le 99\), \(0 \le P \le 99\).

    line `int`, optional

      A line index, only used for defining specObjID for SpecLine files. `line` and `index` cannot both be non-zero.

    index `int`, optional

      An index measure, only used for defining specObjID for SpecLineIndex files. `line` and `index` cannot both be non-zero.

  Returns
    `numpy.ndarray` of `numpy.uint64`

      The specObjIDs of the objects.

  Raises
    `ValueError`

      If the sizes of the arrays don’t match or if the array values are out of bounds.

  Notes

  - On 32-bit systems, makes sure to explicitly declare all inputs as 64-bit integers.

  - This function defines the SDSS-III/IV version of specObjID, used for SDSS DR8 and subsequent data releases. It is not compatible with SDSS DR7 or earlier.

  - If the string form of `run2d` is used, the bits are assigned by the formula \((N - 5) \times 10000 + M \times 100 + P\).

  Examples

      >>> from pydl.pydlutils.sdss import sdss_specobjid
      >>> print(sdss_specobjid(4055,408,55359,'v5_7_0'))
      [4565636362342690816]