rsseismic.Motion module#
- class rsseismic.Motion.DiscoveredMotionPairs(folderPath: str, pairs: list[MotionPairInfo])#
Bases:
objectMotion pairs discovered in a folder for Manual match-to-target selection.
Selection starts empty. Call
select/selectAll, then passselectedPairsintoMotionLibrary.matchToTargetSpectraManual.- property folderPath: str#
- property allPairs: list[MotionPairInfo]#
- property selectedPairs: list[MotionPairInfo]#
- select(pairIds: list[str], selectOnlyListed: bool = True) None#
Select pairs by
pairId.When
selectOnlyListedis True (default), only the listed ids remain selected. When False, listed ids are added to the current selection.
- selectAll() None#
Select every discovered pair.
- deselectAll() None#
Clear the selection.
- class rsseismic.Motion.MotionLibrary(client: Client)#
Bases:
objectApp-level ground motion library (Motion Manager).
No project is required. Use
getMotion(name)for one motion (file name without extension), orgetMotionPair(pairId)for a horizontal pair (shared name prefix of the H1 and H2 files). UsegetUnitSystem/changeUnitSystemto switch Motion Manager display units (Metric or Imperial) for this session.- getMotionPair(pairId: str) MotionPair#
Return one horizontal motion pair from the library.
- getUnitSystem() UnitSystem#
Return the Motion Manager display unit system (Metric or Imperial).
This is independent of the open project’s unit system.
- changeUnitSystem(unitSystem: UnitSystem) UnitSystem#
Switch Motion Manager display units between Metric and Imperial.
Affects properties and tables from the motion library for this session. Does not change the open project’s unit system or Preferences. Returns the unit system now in effect.
- convertMotionText(sourceFilePath: str, motionName: str, outputDirectory: str, accelerationUnit: MotionAccelerationUnit, layout: MotionConvertLayout = MotionConvertLayout.ACCELERATION_ONLY, delimiter: MotionConvertDelimiter = MotionConvertDelimiter.SPACE, overwrite: bool = False, timeStep: float = 0.0, hasTimeStep: bool = False, accelerationColumn: int = 1, timeColumn: int = 1, firstLine: int = 1, lastLine: int = 0) ConvertMotionResult#
Convert a text motion file and add it to the motion library.
outputDirectorymust be one of the Motion Manager preference folders. ForMotionConvertLayout.ACCELERATION_ONLY, sethasTimeStep=Trueand providetimeStep. ForMotionConvertLayout.TIME_AND_ACCELERATION, the timestep is read from the file. SetlastLineto 0 to read through the end of the file.
- convertMotionAT2(sourceFilePath: str, motionName: str, outputDirectory: str, overwrite: bool = False, accelerationUnit: MotionAccelerationUnit | None = None) ConvertMotionResult#
Convert a PEER AT2 acceleration record and add it to the motion library.
outputDirectorymust be one of the Motion Manager preference folders. LeaveaccelerationUnitasNoneto auto-detect the unit from the AT2 header.
- deleteMotions(motionNames: list[str]) DeleteMotionsResult#
Delete motions from the library by name.
Removes the motion files from disk and updates the Motion Manager list. Names that were not found or could not be deleted are returned in
failedMotionNames.
- authenticateDatabase(database: GroundMotionDatabase, username: str, password: str = '') None#
Authenticate against an external ground-motion database for this session.
Call once before
searchDatabaseRecords/importDatabaseRecords/matchToTargetSpectraAutomatic. Password may be omitted for username-only databases (e.g. CESMD).
- searchDatabaseRecords(database: GroundMotionDatabase, filters: DatabaseSearchFilters, maxResults: int | None = None) list[DatabaseRecordInfo]#
Search an external ground-motion database and return matching records.
Call
authenticateDatabasefor this database first. Pass selected records from this result intoimportDatabaseRecords.maxResultsoptionally caps how many records the server returns (omit orNone/<= 0= no scripting-side truncate).
- importDatabaseRecords(database: GroundMotionDatabase, outputDirectory: str, records: list[DatabaseRecordInfo], overwrite: bool = False) ImportDatabaseRecordsResult#
Download selected database records into a Motion Manager preference folder.
Call
authenticateDatabasefor this database first.outputDirectorymust already be listed in Preferences → Motions. Records that fail to download or save are returned infailedRecordIds.
- discoverMotionPairsInFolder(folderPath: str) DiscoveredMotionPairs#
Scan a folder (and subfolders) for horizontal motion pairs.
The returned
DiscoveredMotionPairshas an empty selection. Callselect/selectAll, then passselectedPairstomatchToTargetSpectraManual.
- getTargetSpectra(model: UserDefinedTargetSpectraModel | RexelTargetSpectraModel | NshmpTargetSpectraModel) TargetSpectra#
Generate or load target spectra from a wizard-style model.
Pass one of: -
UserDefinedTargetSpectraModel(filePath)-RexelTargetSpectraModel(...)-NshmpTargetSpectraModel(...)User-defined loads period–Sa points from the spectrum file. REXEL / NSHMP call the remote services and return resolved period–Sa points.
For REXEL, omit fields to use server/UI defaults (NTC18, Rome latitude/longitude, soil class A, and other code-specific wizard defaults). Which extra fields apply depends on
seismicCode.For NSHMP,
longitude/latitudeare required; omit other fields to use server/UI defaults (Conterminous U.S. 2018, vs30 760, AFE 2475, truncate/maxdir false).
- matchToTargetSpectraManual(targetSpectra: TargetSpectra, pairs: list[MotionPairInfo], outputDirectory: str, amplitude: AmplitudeScalingParams | None = None, overwrite: bool = False) MatchToTargetSpectraResult#
Amplitude-scale selected motion pairs to target spectra.
targetSpectrais a period–Sa list (build manually, or fromgetTargetSpectrawith a model such asUserDefinedTargetSpectraModel(path)).pairsmust be an explicit list (typicallydiscovered.selectedPairs).outputDirectorymust already be listed in Preferences → Motions.
- matchToTargetSpectraAutomatic(database: GroundMotionDatabase, filters: DatabaseSearchFilters, targetSpectra: TargetSpectra, outputDirectory: str, selection: RecordSelectionParams | None = None, amplitude: AmplitudeScalingParams | None = None, overwrite: bool = False) MatchToTargetSpectraResult#
Automatically select and scale database records to target spectra.
Requires a prior
authenticateDatabasefordatabase(GMDB or FDSN/ESM only; CESMD is not supported).filtersmust include at least one search criterion.outputDirectorymust already be listed in Preferences → Motions. Omitselection/amplitudeto use wizard defaults (amplitude also drives the selection period window and scale-factor bounds).
- class rsseismic.Motion.Motion(client: Client, motionName: str)#
Bases:
_ProxyObjectInspect and transform one ground motion from the app motion library.
Obtain an instance from
app.MotionLibrary.getMotion(name). Scaling, baseline correction, and timestep reduction write a new motion file and do not add it to the project or library automatically. Estimate Kappa returns fitted (or user-supplied) kappa-line values without plots.- property name: str#
Motion name (file name without extension).
- getProperties() MotionProperties#
Return timestep, Nyquist frequency, PGA, PGV, PGD, and point count.
Unit strings follow the Motion Manager units provider.
- scaleToG(targetG: float, filePath: str, overwrite: bool = False) ScaleMotionResult#
Scale this motion so peak acceleration equals
targetG(in g) and save it.The output file is not added to the motion library. When
overwriteis False (default), an existing file atfilePathis an error.
- scaleBy(factor: float, filePath: str, overwrite: bool = False) ScaleMotionResult#
Multiply this motion’s acceleration by
factorand save it.The output file is not added to the motion library. When
overwriteis False (default), an existing file atfilePathis an error.
- getTimeHistoryData() pandas.DataFrame#
Return the Single Motion View time-history table as a pandas DataFrame.
Columns match the UI grid: Time, Acceleration, Velocity, Displacement, AriasIntensity, and HousnerIntensity. Column units are in
dataframe.attrs["column_units"]when available.
- getSpectralData() tuple[pandas.DataFrame, pandas.DataFrame]#
Return Fourier and spectral-acceleration tables as pandas DataFrames.
- Returns:
A
(fourier, spectralAcceleration)tuple. Fourier columns are Frequency, Amplitude, PhaseAngle, and SmoothedAmplitude. Spectral acceleration columns are Period plus the response-spectrum methods shown in Single Motion View. Column units are indataframe.attrs["column_units"]when available.
- estimateKappaFromBoundingFrequencies(startFrequency: float, endFrequency: float) EstimateKappaResult#
Estimate kappa by linear regression between bounding frequencies (Hz).
Matches the Estimate Kappa dialog option “Bounding frequencies”.
endFrequencymust be less than 100 Hz.
- estimateKappaFromConstantIntercept(kappa: float, yIntercept: float) EstimateKappaResult#
Evaluate the kappa line from a constant kappa and Y-intercept.
Matches the Estimate Kappa dialog option “Constant value and intercept”. Start and end frequencies default to 0 Hz and 100 Hz on the server.
- baselineCorrection(filePath: str, overwrite: bool = False) BaselineCorrectionResult#
Apply baseline correction and save the corrected motion.
The output file is not added to the motion library. When
overwriteis False (default), an existing file atfilePathis an error.
- timestepReduction(factor: int, filePath: str, overwrite: bool = False) TimestepReductionResult#
Reduce the motion timestep by an integer
factorof at least 2 and save it.Use
getProperties()on this motion for the original timestep, Nyquist frequency, and point count. The returnedpropertiesare the reduced motion. The output file is not added to the motion library. Whenoverwriteis False (default), an existing file atfilePathis an error.
- class rsseismic.Motion.MotionPair(client: Client, pairId: str)#
Bases:
_ProxyObjectInspect and transform one horizontal ground-motion pair from the motion library.
Get an instance with
app.MotionLibrary.getMotionPair(pairId). Use this for geometric-mean spectra, effective amplitude spectra, and scaling both components. For tools that apply to one component (kappa, baseline correction, timestep reduction), useh1orh2. Scaling writes new files and does not add them to the library.- property pairId: str#
Pair name (shared prefix of the two horizontal motion file names).
- getProperties() MotionPairProperties#
Return timestep, Nyquist frequency, PGA, PGV, PGD, and point count for both horizontals.
Values use the current Motion Manager display units.
- getTimeHistoryData() tuple[pandas.DataFrame, pandas.DataFrame]#
Return time-history tables for both horizontals.
Each table includes Time, Acceleration, Velocity, Displacement, AriasIntensity, and HousnerIntensity.
- getSpectralData() tuple[tuple[pandas.DataFrame, pandas.DataFrame], tuple[pandas.DataFrame, pandas.DataFrame]]#
Return Fourier and spectral-acceleration tables for both horizontals.
For each component, the first table is Fourier data and the second is spectral acceleration.
- getGeometricMeanSpectrum(spectralType: GeometricMeanSpectralType = GeometricMeanSpectralType.FREQUENCY_DOMAIN) pandas.DataFrame#
Return the geometric-mean response spectrum for this pair.
spectralTypechooses the response-spectrum method (Frequency Domain, Duhamel, Duhamel with timestep correction, Newmark, or Newmark with timestep correction). Defaults to Frequency Domain.
- getEffectiveAmplitudeSpectrum(bandwidth: float | None = None) pandas.DataFrame#
Return the smoothed Effective Amplitude Spectrum (EAS) for this pair.
bandwidthis the Konno-Ohmachi smoothing parameter (PEER Report 2018/05), not a damping ratio. Omit it to use the recommended default (188.5).
- scaleToG(targetG: float, h1FilePath: str, h2FilePath: str, overwrite: bool = False) ScaleMotionPairResult#
Scale each horizontal so peak acceleration equals
targetG(in g) and save both files.Each component is scaled on its own peak. The saved files are not added to the motion library. When
overwriteis False (default), an existing file at either path is an error.
- scaleBy(factor: float, h1FilePath: str, h2FilePath: str, overwrite: bool = False) ScaleMotionPairResult#
Multiply both horizontals by
factorand save both files.The saved files are not added to the motion library. When
overwriteis False (default), an existing file at either path is an error.