Git Product home page Git Product logo

Comments (9)

calum-chamberlain avatar calum-chamberlain commented on June 9, 2024

What have you typed to get the output above?
Is the formatting I have applied correct (see mastering markdown for how to format markdown)?
Is traces a list of streams as required here?

from eqcorrscan.

caro-github avatar caro-github commented on June 9, 2024
  1. linstack = stacking.linstack(traces) called from multi_trace_plot
  2. I do not understand the question
  3. Yes list with 16 <obspy.core.stream.Stream objects

from eqcorrscan.

calum-chamberlain avatar calum-chamberlain commented on June 9, 2024
  1. I meant the print statements, how did you get this:
1 Trace(s) in Stream:
AF.WHYM.03.SHZ | 2009-03-16T17:32:26.770000Z - 2009-03-16T17:32:26.770000Z | 200.0 Hz, 0 samples
0
matchtr []
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
norm []
norm_nantonum []
[] 180000

?
2. I edited your comment so that the code output is formatted, does this look correct to you (as in is it what you saw in your terminal), if not, please format it - in general a working (or failing in this case, but reproducible) example is most helpful.
3. Golden, do all traces of all streams have data in them?

from eqcorrscan.

caro-github avatar caro-github commented on June 9, 2024
  1. I added print commands after every line where the problem occurs:
    for i in range(1, len(streams)):
        for tr in stack:
            tr.plot()
            matchtr = streams[i].select(station=tr.stats.station,
                                        channel=tr.stats.channel)
            print(matchtr)
            print(len(matchtr[0].data))
            if matchtr:
                # Normalize the data before stacking
                if normalize:
	            print('matchtr',matchtr[0].data)

                    norm = matchtr[0].data /\
                        np.sqrt(np.mean(np.square(matchtr[0].data)))
	            print('norm',norm)
                    norm = np.nan_to_num(norm)
	            print('norm_nantonum',norm)
                else:
                    norm = matchtr[0].data
                print(norm,len(tr.data))
                tr.data = np.sum((norm, tr.data), axis=0)
    return stack
  1. tr.plot() in 3.rd line shows me the data, so I don't know if it is the streams[i].select part or something else, if I change the order of the streams or remove the last stream, it's the same problem with whatever stream is last in the list, output for second last from same print commands is:
1 Trace(s) in Stream:
AF.WHYM.03.SHZ | 2009-03-15T04:59:58.295000Z - 2009-03-15T05:14:58.290000Z | 200.0 Hz, 180000 samples
180000
matchtr [ 0.00777793  0.05530805  0.18358414 ..., -1.03355332 -1.84595387
  0.00971802]
norm [ 0.00015242  0.00108381  0.00359751 ..., -0.02025346 -0.03617322
  0.00019043]
norm_nantonum [ 0.00015242  0.00108381  0.00359751 ..., -0.02025346 -0.03617322
  0.00019043]
[ 0.00015242  0.00108381  0.00359751 ..., -0.02025346 -0.03617322
  0.00019043] 180000

from eqcorrscan.

calum-chamberlain avatar calum-chamberlain commented on June 9, 2024

It looks like you have a stream with an empty trace in it?
Please try to format code, it makes it much easier to read, it's really easy to do...

from eqcorrscan.

caro-github avatar caro-github commented on June 9, 2024

I get the same problem with 2 other completely different datasets, and I already spent many hours on this. It is not as simple as one empty trace, I can assure you that

from eqcorrscan.

calum-chamberlain avatar calum-chamberlain commented on June 9, 2024

Can you email me the streams?

from eqcorrscan.

caro-github avatar caro-github commented on June 9, 2024

The streams are not empty but there is something weird about them, I think the first one might be a collection of traces rather than individual traces

from eqcorrscan.

caro-github avatar caro-github commented on June 9, 2024

I have now been able to narrow down the problem with the data in traces disappearing: In if realign: in plotting.multi_trace_plot the line _pick.time -= shifts[i] resulted in an error because shifts[i] is a tuple and not a float, so I changed it to _pick.time -= shifts[i][1] which solved the problem but may have caused my problem. If you add the line print("Len Traces data", [len(traces[i].data) for i in range(0,len(traces))]) before and after the if loop it results in the first value for the traces[0].data to be empty (but the stream not being empty because the header info is there) resulting in the problem in linstack. So I may have caused the problem myself through the correction I made, but I don't understand why this hadn't been an issue before.

from eqcorrscan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.