Git Product home page Git Product logo

Comments (5)

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

Thanks for raising this! This is an unusual use case, but hopefully the code can be useful for you.

Do all your traces have the same (imprecise) sampling-rate? If not then you should make sure they are all set to the same value if you expect them to be. Then I would suggest that you set samp_rate to that value. I don't think that the precision of samp_rate is changed anywhere (I hope it isn't), so that should compare as equal. Perhaps you have tried that though and this issue still happens?

It would be good to expose an option to not resample (e.g. by setting samp_rate=None to disable resampling), but in the matched-filter steps the sample-rate of the continuous data are compared to the sample rate of the template to ensure that they are the same and if they are not it will resample. If this is a floating point accuracy bug that gives different results for different epochs then that will be an issue. Keen to know what you have found in your experience and happy to try and help.

from eqcorrscan.

vSahakian avatar vSahakian commented on June 26, 2024

Thanks for such a fast response!

I dug in a bit more and realized that the problem is in my conversion to a SAC file, so I can use the SAC method in template_gen. I convert csv files to miniseed, then convert and write to SAC (with a pick time), and subsequently template_gen reads these back in. Somewhere in either the writing or reading of the SAC file, the sampling rate gets converted from delta=60.0 to 0.01666666753590107 (instead of 1/60 or 0.01666666666666666).

I agree that forcing it to resample would not be ideal. What are your thoughts on either using np.isclose on line 570 of pre_processing.py (instead of a logical testing equality - the default could be atol=0 which is the same as identical values), or otherwise adding an option to read in mseed files to template_gen? If easier, I could make suggested code changes.

Thank you!

from eqcorrscan.

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

You can pass any Stream to most of the template creation functions/methods, but we don't support passing filenames - you have to read the file using obspy first, so you can pass miniseed to those (so long as you read the file first). You would use the from_meta_file method and pass a stream. In general I would avoid the SAC methods!

Also, generally it is better to use the object oriented API (Template and Tribe objects). The functions in template_gen are only there for legacy purposes. Similar to template_gen you should use the from_meta_file method.

Using np.isclose is a nice idea, we could do that, but I'm loath to introduce something that could be used to hide other issues (e.g. file conversion issues).

from eqcorrscan.

vSahakian avatar vSahakian commented on June 26, 2024

Perfect, the from_meta_file method works! Thank you so much!

from eqcorrscan.

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

I really need to get back to finishing the local file tutorial in based on #468! If there is anything else you would like to see in a tutorial then let me know. I'm going to close this, but feel free to reply.

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.