00. Getting Started - RJbalikian/SPRIT-HVSR GitHub Wiki

If you are new to SpRIT, there is a Jupyter Notebook with example scripts that may be of interest to you in the main code repository here. You can run that in your browser using Github's Codespaces or Google Colab, or if you have python installed on your system you can download that file and run it locally. Instructions for setting that up are at the bottom of this page.

Setup

You will first need to install SpRIT. SpRIT is hosted on python's official pypi repository here, so it can be installed using the pip command (assuming you already have python installed):

pip install sprit

This should be all you need to do to install SpRIT.

Usage

It is recommended to use the sprit.run() function for most processing needs. This function uses several other functions to string together a complete HVSR processing workflow for assessment of $f_0$ at a single site.

More information on the constituent functions of sprit.run() is available here, but in short, sprit.run() contains:

*Optional step

NOTE: The arguments of the any of the functions used to process the HVSR data (listed above) can be passed directly into the sprit.run() function. Use the help(sprit.run()) command to get a description and list of these parameters.

Example scripts

To understand the data and results, you can run SpRIT using a sample dataset. The input_parameter is the only required parameter for the sprit.run() function (see more about sprit.run() here).

import sprit

hvsrData = sprit.run(input_data='sample')

There are many other parameters you could add that are recommended, especially:

## Location and other metadata
hvsrData = sprit.run(
    ... # any of the parameters for .run() can go here
    site='Site name',
    project='Project name',
    xcoord=-90.05, # coordinate in CRS designated in input_crs, by default WGS84
    ycoord=35,
    input_crs="EPSG:4326",
    elevation=250, #in meters by default
    elev_unit='m', #could also be 'feet' or 'ft'
    hvsr_export_path=r"path/to/export/for/pickled/file.hvsr",
    report_export_path=r"path/to/export/report.pdf" #by default, a pdf file
    data_export_path=r"path/to/export/datafile.mseed" #standard seismic data file to export data stream
    )

Tromino Data

NOTE: THIS HAS ONLY BEEN TESTED ON LIMITED DATA FROM TROMINO 3G+ AND TROMINO BLUE AND MAY NOT WORK WITH OTHER SYSTEMS

Probably the easiest way to read in Tromino data is to first read the data (and return an obspy.Stream) then read that data into the rest of the algorithm. You will first need to export your data from the Tromino.

import sprit

# Your filepath should point to the .trc file
trcFilepath = r"path/to/data/file.trc"
sampleRate = 128 # Set this equal to the sampling rate at which you collected the data. 
                 # For Tromino Blue dat, an attempt will be made to ascertain the sampling rate from the data itself, but this is experimental

trominoModel = "Tromino Blue" # Just "Tromino" or "Tromino 3G+" or "Tromino yellow" for that model, for example

# This should return an obspy.Stream object
trominoDataStream = sprit.read_tromino_files(input_data=trcFilepath,tromino_model=trominoModel, sampling_rate=sampleRate)

#optional: view your data
trominoDataStream.plot()

# You can/should additionally fill out the parameters as shown above
trominoData = sprit.run(input_data=trominoDataStream, instrument=trominoModel)

Raspberry Shake data

SpRIT was designed to read data exported from Raspberry Shakes. If data is exported directly from a Raspberry Shake, it usually has the following directory structure:

STATION_NAME
├── EHZ.D
├── EHE.D
└── EHN.D

where STATION_NAME is the name of the Raspberry Shake Station you are using. Daily data files for each component are in the respective folder.

To directly read this data in, use the following:

import sprit
rsData = sprit.run(input_data=r"path/to/folder/with/STATION_NAME", 
    source='raw', 
    instrument='Raspberry Shake',
    network="AM", #Raspberry shakes are on the AM network
    station="RS100", # The name of your raspberry shake
    acq_date="2025-01-31", #Example for date of Jan 31, 2025
    starttime="15:01", #This could also be an obspy.UTCDateTime object or datetime.datetime object
    endtime="16:01", # same as above
    tzone="US/Central", # official IANA timezone name, will get translated to UTC
    )

Other seismic files readable by obspy

If your data is already in a file format that is readable by obspy, you should be able to read in your data directly with no other required inputs (though location metadata is recommended to be entered).

hvsrData = sprit.run(input_data=r"path/to/seismicfile.mseed")

If you have instrument response in a format readable by obspy, you can set the metapath variable equal to that filepath and SpRIT will attempt to attach the instrument response to your data and process accordingly.