Error when using KinSrcTimeHistory


I modified the subduction-2d example in order to prescribe a postseismic slip following a “time history” slip function, using KinSrcTimeHistory.

However, I got the following error:

TypeError: KinSrcTimeHistory.preinitialize() takes 1 positional argument but 2 were given

I use Pylith 3.0.3 from the binaries (pylith-3.0.3-macOS-12.0-arm64) on a Mac M1 (ARM).
Attached in a zip are the full error message, input files, and the JSON output file.

I checked a lot of parameters but I cannot figure out what is the source of this error.

Thank you very much for any help. (2.7 MB)

The error message suggests that it is a bug in the code. I will investigate.

Thanks for reporting this error.

KinSrcTimeHistory.preinitialize() is missing an argument. The short-term fix is to edit the pylith-3.0.3-macOS-12.0-arm64/lib/python3.10/site-packages/pylith/faultspylith/faults/ as shown in FIX: Add missing 'problem' argument to KinSrcTimeHistory.preinitializ… · geodynamics/pylith@3d1d04b · GitHub.

We will work on adding an appropriate test case to ensure this is fixed permanently. We will either do a bugfix release or just include this in the next release, if it comes soon enough.

Thank you very much for your quick fix.

I applied the fix in, it solved the argument issue.

However, it now returns an error relative to a non-existent SetTimeHistory function in KinSrcTimeHistory (full log attached):

File “/Users/test/Documents/Modelisation/pylith/pylith-3.0.3-macOS-12.0-arm64/lib/python3.10/site-packages/pylith/faults/”, line 69, in preinitialize

  • ModuleKinSrc.setTimeHistory(self, self.dbTimeHistory)*
    AttributeError: type object ‘KinSrcTimeHistory’ has no attribute ‘setTimeHistory’

error_msg_2.txt (1.5 KB)

Thanks for reporting this additional information. This looks like more bugs. I now have a test in mind and will implement it and resolve this issue when I can (it may take a couple weeks).

I finally had time to create an appropriate test and have submitted a pull request with the fixes.

Here is the GitHub commit with the fixes:

These are all in the file, so you can do them manually before the next release.

The KinSrcTimeHistory function is working fine now, thank you very much for the fix.