Git Product home page Git Product logo

Comments (5)

Ulvetanna avatar Ulvetanna commented on May 30, 2024

def str(self):
'''
STUFF GOES HERE
'''

from quakemigrate.

hemmelig avatar hemmelig commented on May 30, 2024

Magic method__str__() returns a printable string representation of any user defined class when str(object) is called.

from quakemigrate.

tmgreenfield1101 avatar tmgreenfield1101 commented on May 30, 2024

I have a print string suggestion for class LUT:

def __str__(self):
    """
    Return short summary string of the LUT object

    It will provide the defining properties of the LUT - location, underlying
    grid properties and the simple 1D velocity structure.

    """
    out = "QuakeMigrate traveltime look-up table"
    out += "\n\tGrid centre\t:\t{lat:10.5f}\u00b0N {lon:10.5f}\u00b0E {dep:6.3f} km"
    out += "\n\tNumber of cells\t:\t{xn:4d} {yn:4d} {zn:4d}"
    out += "\n\tCell size\t:\t{xs:6.3f} km {ys:6.3f} km {zs:6.3f} km"
    out += "\n\t1D velocity model:"
    out += "\n\t\tDepth\tVp\tVs"

    out = out.format(xn=self.cell_count[0], yn=self.cell_count[1],
                     zn=self.cell_count[2], xs=self.cell_size[0] / 1000.,
                     ys=self.cell_size[1] / 1000., zs=self.cell_size[2] / 1000.,
                     lat=self.latitude, lon=self.longitude, dep=self.elevation / 1000.)

    for i, layer in self.velocity_model.iterrows():
        vel = "\t\t{:6.3f}\t{:6.3f}\t{:6.3f}"
        vel = vel.format(layer["depth"] / 1000., layer["vp"] / 1000.,
                         layer["vs"] / 1000.)

        out += "\n{}".format(vel)

    return out

from quakemigrate.

hemmelig avatar hemmelig commented on May 30, 2024

Print string suggestion for class mSEED:

def __str__(self):
    """
    Return short summary string of the mSEED object

    It will provide information about the archive location and structure,
    data sampling rate and time period over which the archive is being queried.

    """

    out = "QuakeMigrate mSEED object"
    out += "\n\tHost path\t:\t{}".format(self.MSEED_path)
    out += "\n\tPath structure\t:\t{}".format(self.format)
    out += "\n\tResampling\t:\t{}".format(self.resample)
    out += "\n\tSampling rate\t:\t{}".format(self.sampling_rate)
    out += "\n\tStart time\t:\t{}".format(str(self.start_time))
    out += "\n\tEnd time\t:\t{}".format(str(self.end_time))
    out += "\n\tStations:"
    for station in self.stations:
        out += "\n\t\t{}".format(station)

    return out

On initialisation, the object only contains the host path and stations - the path structure is set by a user function call. The start time, end time and sampling rate are altered on the fly for each time step of detect.

from quakemigrate.

hemmelig avatar hemmelig commented on May 30, 2024

Print string suggestion for class SeisScan:

    def __str__(self):
        """
        Return short summary string of the SeisScan object

        It will provide information on all of the various parameters that the
        user can/has set.

        """

        out = "QuakeMigrate parameters"
        out += "\n\tTime step\t\t:\t{}".format(self.time_step)
        out += "\n\n\tData sampling rate\t:\t{}".format(self.sampling_rate)
        out += "\n\tOutput sampling rate\t:\t{}".format(
            self.output_sampling_rate)
        out += "\n\n\tDecimation\t\t:\t[{}, {}, {}]".format(
            self.decimate[0], self.decimate[1], self.decimate[2])
        out += "\n\n\tBandpass filter P\t:\t[{}, {}, {}]".format(
            self.p_bp_filter[0], self.p_bp_filter[1], self.p_bp_filter[2])
        out += "\n\tBandpass filter S\t:\t[{}, {}, {}]".format(
            self.s_bp_filter[0], self.s_bp_filter[1], self.s_bp_filter[2])
        out += "\n\n\tOnset P [STA, LTA]\t:\t[{}, {}]".format(
            self.p_onset_win[0], self.p_onset_win[1])
        out += "\n\tOnset S [STA, LTA]\t:\t[{}, {}]".format(
            self.s_onset_win[0], self.s_onset_win[1])
        out += "\n\n\tPre-pad\t\t\t:\t{}".format(self.pre_pad)
        out += "\n\tPost-pad\t\t:\t{}".format(self.post_pad)
        out += "\n\n\tMarginal window\t\t:\t{}".format(self.marginal_window)
        out += "\n\tMinimum repeat\t\t:\t{}".format(self.minimum_repeat)
        out += "\n\tDetection threshold\t:\t{}".format(self.detection_threshold)
        out += "\n\tPick threshold\t\t:\t{}".format(self.pick_threshold)
        out += "\n\tPicking mode\t\t:\t{}".format(self.picking_mode)
        out += "\n\tPercent ttime\t\t:\t{}".format(self.percent_tt)
        out += "\n\tLocation error\t\t:\t{}".format(self.location_error)
        out += "\n\n\tCentred onset\t\t:\t{}".format(self._onset_centred)
        out += "\n\tNormalise coalescence\t:\t{}".format(
            self.normalise_coalescence)
        out += "\n\n\tNumber of CPUs\t\t:\t{}".format(self.n_cores)

        return out

This could be improved - currently I just put out every parameter that can be set by the user with some basic grouping and formatting.

from quakemigrate.

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.