This page was created by the IDL library routine `mk_html_help2`.

Last modified: Tue Aug 5 18:17:40 2025.

# Directory Listing of Routines

# projects/SWFO/STIS

- ASCII_READER__DEFINE
- CCSDS_FRAME_READER__DEFINE
- CCSDS_READER__DEFINE
- CMBLK_KEYSIGHT__DEFINE
- CMBLK_READER__DEFINE
- GSE_IONGUN_READER__DEFINE
- GSE_KEITHLEY__DEFINE
- GSE_KEYSIGHT__DEFINE
- GSEMSG_READER__DEFINE
- JSON_READER__DEFINE
- PACKET_READER__DEFINE
- PTP_READER__DEFINE
- SWFO_CCSDS_SPKT_HANDLER
- SWFO_FILE_RETRIEVE
- SWFO_GEN_APDAT__DEFINE
- SWFO_GSEMSG_LUN_READ
- SWFO_PTP_LUN_READ
- SWFO_PTP_RECORDER
  Widget tool that opens a socket and records streaming data from a server (host) and can save it to a file
- SWFO_PULSER_CAL
- SWFO_RAW_TLM__DEFINE
- SWFO_RECORDER
  Widget tool that opens a socket and records streaming data from a server (host) and can save it to a file
- SWFO_SPC_MET_TO_UNIXTIME
- SWFO_STIS_ADC_MAP[1]
- SWFO_STIS_ADC_MAP[2]
- SWFO_STIS_APDAT_INIT
- SWFO_STIS_CRIB
- SWFO_STIS_INST_RESPONSE_CRIB
  performs cross product on arrays
- SWFO_STIS_PLOT
- SWFO_SWIFULATOR_LUN_READ

# Routine Descriptions

## ASCII_READER__DEFINE

[Next Routine] [List of Routines]

      ascii_reader
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/ascii_reader__define.pro $

(See projects/SWFO/STIS/ascii_reader__define.pro)

## CCSDS_FRAME_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE ccsds_reader
      This object is a collecton of routines to process socket stream and files that have CCSDS packets
      is only specific to SWFO in the default decom_procedure on initialization.
      When a complete ccsds packet is read in  it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/ccsds_frame_reader__define.pro)

## CCSDS_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE ccsds_reader
      This object is a collecton of routines to process socket stream and files that have CCSDS packets
      is only specific to SWFO in the default decom_procedure on initialization.
      When a complete ccsds packet is read in  it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/ccsds_reader__define.pro)

## CMBLK_KEYSIGHT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      cmblk_keysight
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/cmblk_keysight__define.pro $

(See projects/SWFO/STIS/cmblk_keysight__define.pro)

## CMBLK_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      cmblk_reader
      This basic object is the entry point for defining and obtaining all data from common block files
      A description of this file format is available at:
      https://docs.google.com/presentation/d/1b5ooHfuHJsavys-BOUOOZohXeCzJC1M0MNaUlxM1tEg/edit?usp=sharing
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2024-11-04 20:21:48 -0800 (Mon, 04 Nov 2024) $
     $LastChangedRevision: 32933 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/cmblk_reader__define.pro $

(See projects/SWFO/STIS/cmblk_reader__define.pro)

## GSEMSG_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE SWFO_GSEMSG_Buffer_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the MSG header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened MSG file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a MSG header.
      When a complete MSG header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/gsemsg_reader__define.pro)

## GSE_IONGUN_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      gse_iongun_reader
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/gse_iongun_reader__define.pro $

(See projects/SWFO/STIS/gse_iongun_reader__define.pro)

## GSE_KEITHLEY__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

    gse_keithley
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/gse_keithley__define.pro $

(See projects/SWFO/STIS/gse_keithley__define.pro)

## GSE_KEYSIGHT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

    gse_keysight
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/gse_keysight__define.pro $

(See projects/SWFO/STIS/gse_keysight__define.pro)

## JSON_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      json_reader
      This object works with the common block files to decommutate data from Keysight power supplies
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/json_reader__define.pro $

(See projects/SWFO/STIS/json_reader__define.pro)

## PACKET_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE SWFO_GSEMSG_Buffer_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the MSG header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened MSG file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a MSG header.
      When a complete MSG header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/packet_reader__define.pro)

## PTP_READER__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE ptp_reader
      This object is a collecton of routines to process socket stream and files that have CCSDS packets
      is only specific to SWFO in the default decom_procedure on initialization.
      When a complete ccsds packet is read in  it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/ptp_reader__define.pro)

## SWFO_CCSDS_SPKT_HANDLER

[Previous Routine] [Next Routine] [List of Routines]

     Purpose: Decomutate a single CCSDS data packet and uses the apid to retrieve an object that can process the specific APID
     Input:  byte array that containing a single CCSDS data packet

     Written by Davin Larson

     $LastChangedBy: davin-mac $
     $LastChangedDate: 2024-11-01 10:08:56 -0700 (Fri, 01 Nov 2024) $
     $LastChangedRevision: 32915 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_ccsds_spkt_handler.pro $

(See projects/SWFO/STIS/swfo_ccsds_spkt_handler.pro)

## SWFO_FILE_RETRIEVE

[Previous Routine] [Next Routine] [List of Routines]

     Written by Davin Larson

     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-03-04 10:57:07 -0800 (Tue, 04 Mar 2025) $
     $LastChangedRevision: 33161 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_file_retrieve.pro $

     Function:  files = spp_file_retrieve(PATHNAME)
     Purpose:  Retrieve or Download Solar Probe data files (i.e. L0 files)  (Can be used to generate filenames too)
     INPUT:
     PATHNAME:  string specifying relative path to files.         Default might change-  Currently:  'psp/pfp/l0/YYYY/MM/mvn_pfp_all_l0_YYYYMMDD_v???.dat'
             PATHNAME must be relative to the LOCAL_DATA_DIR and REMOTE_DATA_DIR fields of the source keyword.
             "globbed" filenames (*,?) are accepted.
     typical usage:
       files = spp_file_retrieve('psp/xxxxxx/YYYY/MM/mvn_pfp_all_l0_YYYYMMDD_v???.dat',/daily_names)   ; get L0 files for user defined time span
       files = spp_file_retrieve(pathname,/daily_names,trange=trange)  ; set time range
    Keywords:  (All are optional - none are recommended)
     L0:   set to 1 to return PFP L0 files
     DAILY_NAMES : resolution (in days) for generating file names.
             YYYY, yy, MM, DD,  hh,  mm, ss, .f, DOY, DOW, TDIFF are special characters that will be substituted with the appropriate date/time field
             Be especially careful of extensions that begin with '.f' since these will be translated into a fractional second.
             See "time_string"  TFORMAT keyword for more info.
     TRANGE : two element vector containing start and end times (UNIX_TIME or UT string).  if not present then timerange() is called to obtain the limits.
     SOURCE:  alternate file source.   Default is whatever is return by the function:  mvn_file_source()    (see "mvn_file_source" for more info)
     FILES:  if provided these will be passed through as output.
     VALID_ONLY:  Set to 1 to prevent non existent files from being returned.
     CREATE_DIR:  Generates a filename and creates the directories needed to create the file without errors.  Will not check for file on remote server.

     KEYWORDS Passed on to "FILE_RETRIEVE":
     LAST_VERSION : [0,1]  if set then only the last matching file is returned.  (Default is defined by source)
     VALID_ONLY:  [0,1]   If set then only existing files are returned.  (Default is defined by source keyword)
     VERBOSE:  set verbosity level (2 is typical)
     USER_PASS:  user:password combination for the remote server
     LIMITATIONS:
       Beware of file pathnames that include the character sequences:  YY,  MM, DD, hh, mm, ss, .f  since these can be retranslated to the time

(See projects/SWFO/STIS/swfo_file_retrieve.pro)

## SWFO_GEN_APDAT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      swfo_GEN_APDAT
      This basic object is the entry point for defining and obtaining all data for all apids
     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-03-04 10:57:07 -0800 (Tue, 04 Mar 2025) $
     $LastChangedRevision: 33161 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_gen_apdat__define.pro $

(See projects/SWFO/STIS/swfo_gen_apdat__define.pro)

## SWFO_GSEMSG_LUN_READ

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE SWFO_GSEMSG_LUN_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the PTP header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened PTP file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a PTP header.
      When a complete PTP header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/swfo_gsemsg_lun_read.pro)

## SWFO_PTP_LUN_READ

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE SWFO_PTP_LUN_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the PTP header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened PTP file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a PTP header.
      When a complete PTP header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/swfo_ptp_lun_read.pro)

## SWFO_PTP_RECORDER

[Previous Routine] [Next Routine] [List of Routines]

    WIDGET Procedure:
      swfo_ptp_recorder
    PURPOSE:
     Widget tool that opens a socket and records streaming data from a server (host) and can save it to a file
     or send to a user specified routine. This tool runs in the background.
     Keywords:
       SET_FILE_TIMERES : defines how often the current output file will be closed and a new one will be opened
       DIRECTORY:  string prepended to fileformat when opening an output file.
     Author:
        Davin Larson - April 2011

     $LastChangedBy: ali $
     $LastChangedDate: 2021-09-24 16:07:57 -0700 (Fri, 24 Sep 2021) $
     $LastChangedRevision: 30319 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_ptp_recorder.pro $

(See projects/SWFO/STIS/swfo_ptp_recorder.pro)

## SWFO_PULSER_CAL

[Previous Routine] [Next Routine] [List of Routines]

     swfo_pulser_cal
     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-01-15 09:28:13 -0800 (Sun, 15 Jan 2023) $
     $LastChangedRevision: 31406 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_pulser_cal.pro $
     $ID: $

(See projects/SWFO/STIS/swfo_pulser_cal.pro)

## SWFO_RAW_TLM__DEFINE

[Previous Routine] [Next Routine] [List of Routines]

      PROCEDURE SWFO_GSEMSG_Buffer_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the MSG header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened MSG file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a MSG header.
      When a complete MSG header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/swfo_raw_tlm__define.pro)

## SWFO_RECORDER

[Previous Routine] [Next Routine] [List of Routines]

    WIDGET Procedure:
      swfo_recorder
    PURPOSE:
     Widget tool that opens a socket and records streaming data from a server (host) and can save it to a file
     or send to a user specified routine. This tool runs in the background.
     Keywords:
       SET_FILE_TIMERES : defines how often the current output file will be closed and a new one will be opened
       DIRECTORY:  string prepended to fileformat when opening an output file.
     Author:
        Davin Larson - April 2011

     $LastChangedBy: davin-mac $
     $LastChangedDate: 2023-11-13 07:46:41 -0800 (Mon, 13 Nov 2023) $
     $LastChangedRevision: 32242 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_recorder.pro $

(See projects/SWFO/STIS/swfo_recorder.pro)

## SWFO_SPC_MET_TO_UNIXTIME

[Previous Routine] [Next Routine] [List of Routines]

    Function:  spp_spc_met_to_unixtime
    Purpose:  Convert MET (mission Elapsed Time) to Unix Time  (which is almost equivalent to UTC)
    see also:  "spp_spc_unixtime_to_met" for the reverse conversion
     This routine is in the process of being modified to use SPICE Kernels to correct for clock drift as needed.
     Author: Davin Larson
     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-03-04 10:57:07 -0800 (Tue, 04 Mar 2025) $
     $LastChangedRevision: 33161 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_spc_met_to_unixtime.pro $

(See projects/SWFO/STIS/swfo_spc_met_to_unixtime.pro)

## SWFO_STIS_ADC_MAP[1]

[Previous Routine] [Next Routine] [List of Routines]

     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-07-21 09:58:52 -0700 (Mon, 21 Jul 2025) $
     $LastChangedRevision: 33476 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_stis_adc_map.pro $
     $ID: $

(See projects/SWFO/STIS/swfo_stis_adc_map.pro)

## SWFO_STIS_ADC_MAP[2]

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:  SWFO_STIS_ADC_MAP
    PURPOSE: Generates the bins and bin widths used by SWFO STIS
     depending on:
     - uselut_flag: 1 if uploaded LUT is in-use, else 0.
         The "U" in PTCU_BITS. Typically False
     - linear_mode: 1 if NONLUT_MODE is not 0, else 0.
         Second bit in DETECTOR_BITS. Typically 0 (AKA logarithmic bins).
     - resolution: the pulse height resolution in ADC units, used only if linear_mode.
         Typically 3
     - translate: offset of the pulse height in ADC units
         Typically 16

     Function returns a dictionary containing multiple 48 (# pulse height bins)
     x 14 (# coincidences) arrays:
     - adc0: lower edge of the bin in ADC units
     - dadc: width of bin in ADC units
     - adc_n: midpoint of bin in ADC units
     - mnrg: measured energy
     - geom: Geometric factor
     - ftoi

     Test the function using :
     map = swfo_stis_adc_map(data_sample={ptcu_bits: [0, 0, 1, 0], detector_bits: [1, 0, 63], sci_resolution: 3, sci_translate: 16})

     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-07-21 09:58:52 -0700 (Mon, 21 Jul 2025) $
     $LastChangedRevision: 33476 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_stis_adc_map.pro $
     $ID: $

(See projects/SWFO/STIS/swfo_stis_adc_map.pro)

## SWFO_STIS_APDAT_INIT

[Previous Routine] [Next Routine] [List of Routines]

     $LastChangedBy: davin-mac $
     $LastChangedDate: 2024-10-11 14:12:48 -0700 (Fri, 11 Oct 2024) $
     $LastChangedRevision: 32885 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_stis_apdat_init.pro $

(See projects/SWFO/STIS/swfo_stis_apdat_init.pro)

## SWFO_STIS_CRIB

[Previous Routine] [Next Routine] [List of Routines]

     This crib sheet will help explain how to use the SWFO STIS Ground processing software
     Typically a crib sheet can be used to "copy" and "paste" commands into an IDL command window
     This crib sheet can be used as a program to be run from beginning to end.

     These tools are not intended as a final product but can be used to create high level ouput.

     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-06-03 15:59:53 -0700 (Tue, 03 Jun 2025) $
     $LastChangedRevision: 33366 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_stis_crib.pro $
     $ID: $

(See projects/SWFO/STIS/swfo_stis_crib.pro)

## SWFO_STIS_INST_RESPONSE_CRIB

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:  crossp_trans(a,b)
    INPUT:
     a,b:  real(3,n) vector arrays dimension (3,n) or (3)
    PURPOSE:
     performs cross product on arrays
    CREATED BY:
     Davin Larson

(See projects/SWFO/STIS/swfo_stis_inst_response_crib.pro)

## SWFO_STIS_PLOT

[Previous Routine] [Next Routine] [List of Routines]

     This routine can be used for interactive plotting.
     Run using:
     ctime,routine_name='swfo_stis_plot',/silent

     $LastChangedBy: rjolitz $
     $LastChangedDate: 2025-07-01 14:19:06 -0700 (Tue, 01 Jul 2025) $
     $LastChangedRevision: 33417 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/SWFO/STIS/swfo_stis_plot.pro $
     $ID: $

(See projects/SWFO/STIS/swfo_stis_plot.pro)

## SWFO_SWIFULATOR_LUN_READ

[Previous Routine] [List of Routines]

      PROCEDURE SWFO_SWIFULATOR_LUN_READ
      This procedure is only specific to SWFO in the "sync bytes" found in the  header.  Otherwise it could be considered generic
      It purpose is to read bytes from a previously opened  file OR stream.  It returns at the end of file (for files) or when
      no more bytes are available for reading from a stream.
      It should gracefully handle sync errors and find sync up on a swifulator header.
      When a complete PTP header and its enclosed CCSDS packet are read in, it will execute the routine "swfo_ccsds_spkt_handler"

(See projects/SWFO/STIS/swfo_swifulator_lun_read.pro)