SeismicSource / sourcespec

Earthquake source parameters from P- and S-wave displacement spectra
https://sourcespec.seismicsource.org
Other
49 stars 12 forks source link

TypeError: cannot unpack non-iterable float object #12

Closed fabian-kutschera closed 1 year ago

fabian-kutschera commented 1 year ago

Hi,

I came across your repository and since I am interested in source spectra I thought I give it a try by following the "Getting started - For the impatient" documentation.

I obtained my data as follows:

I generated the config file as described and adjusted the station_metadata variable. When I run source_spec -t traces.mseed -q event.xml it runs until computing the radiated energy, but then returns the following type error:


TypeError Traceback (most recent call last) /import/freenas-m-04-students/fkutschera/miniconda3/envs/python37/bin/source_spec in 6 if name == 'main': 7 sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) ----> 8 sys.exit(main())

/import/freenas-m-04-students/fkutschera/miniconda3/envs/python37/lib/python3.7/site-packages/sourcespec/source_spec.py in main() 72 # Save output 73 from sourcespec.ssp_output import write_output ---> 74 write_output(config, sourcepar) 75 76 # Save residuals

/import/freenas-m-04-students/fkutschera/miniconda3/envs/python37/lib/python3.7/site-packages/sourcespec/ssp_output.py in write_output(config, sourcepar) 454 """Write results to a plain text file and/or to a SQLite database file.""" 455 # Write to parfile --> 456 _write_parfile(config, sourcepar) 457 # Write to database, if requested 458 _write_db(config, sourcepar)

/import/freenas-m-04-students/fkutschera/miniconda3/envs/python37/lib/python3.7/site-packages/sourcespec/ssp_output.py in _write_parfile(config, sourcepar) 243 244 Er_mean = means['Er'] --> 245 Er_minus, Er_plus = errors['Er'] 246 # format Er_plus and Er_minus to print it with the same exponent of Er 247 Er_minus_str = _format_exponent(Er_minus, Er_mean)

TypeError: cannot unpack non-iterable float object

I attach the files form the sspec_out and would be very happy to get a brief feedback from you. Since I am just getting started I probably did a mistake on the way.

Best regards, Fabian

sspec_out.tar.gz

claudiodsf commented 1 year ago

Dear Fabian, thanks for your feedback.

What you found is a bug, related to the fact that Er could not be computed for the given station and no other station is available.

I cannot upload to this repository a quick fix for v1.6, since the code has quite evolved and v1.7 will be released soon.

However, you can apply the fix yourself, by replacing /import/freenas-m-04-students/fkutschera/miniconda3/envs/python37/lib/python3.7/site-packages/sourcespec/ssp_output.py with the following file (once unzipped). ssp_output.py.zip

Please note that I never tested SourceSpec at regional or teleseismic distances (your station is ~1900 km from the epicentre). Looking at the trace plot, it seems that the S-window is not correct (and certainly too short, look at win_length parameter), and the noise window is probably contaminated by the P arrival and must be shifted earlier (look at noise_pre_time parameter).

11331986 traces

The obtained spectrum, therefore makes little sense to me:

11331986 ssp

What is your use case? Are you interested to events at regional distances?

claudiodsf commented 1 year ago

This is now fixed in the development version.

fabian-kutschera commented 1 year ago

Dear Claudio, thank you very much for your response and the fix.

I would like to investigate the Mw 7.0 Samos earthquake from October 2020 (https://earthquake.usgs.gov/earthquakes/eventpage/us7000c7y0/executive) and was interested to apply your really nice tool to see, if I could obtain similar earthquake source parameters compared to the proposed ones.

My original choice of a teleseismic recording was probably not a good one, therefore I changed now to a local recording (station HL.ARG..HH* with a distance of 223 km). However, my obtained moment magnitude of 4.5 is still significantly lower than the real earthquake magnitude of Mw7.

So far I rely on the default choice of theoretical picks from the iasp91 model. If I would pick the arrival times by myself using sac, do you think the large discrepancy in moment magnitude could be resolved?

claudiodsf commented 1 year ago

Dear Fabian, It would be useful if you can show me some trace and spectral plots from SourceSpec output.

I just opened the "Discussion" section on this repository (https://github.com/SeismicSource/sourcespec/discussions).

Maybe we can move there: the discussion can potentially interest other users.

Feel free to open a new discussion and I will reply over there.