Changeset 17


Ignore:
Timestamp:
30.10.2008 20:28:00 (11 years ago)
Author:
marcus
Message:

internal: r2 | svn | 2008-01-04 07:52:19 +0100 (Fr, 04 Jan 2008) | 1 line

implemented measurement of amplitudes (vel/disp) on traces filtered with bandpass filters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SH_SHM/trunk/source/motif/cbutil.c

    r16 r17  
    19371937        float      frq;                    /* frequency of signal in Hz */ 
    19381938        float      tffac;                  /* transfer function factor */ 
     1939        float      tffac2;                 /* second factor of this kind */ 
    19391940        char       lfilname[BC_LINELTH+1]; /* local filter name */ 
    19401941        TIME       ttime;                  /* trace time */ 
     
    19571958        frq = 1/period; 
    19581959 
     1960        /* if a filter is applied the comment info entry contains its name */ 
    19591961        locstat = BC_NOERROR; 
    19601962        db_gets( trcptr, ES_COMMENT, BC_LINELTH, str, &locstat ); 
    19611963        if  (locstat == BC_NOERROR)  { 
     1964                /* we have to look for a substring starting with 'FLT:' */ 
    19621965                filptr = strstr( str, "FLT:" ); 
    19631966                if  (filptr == NULL)  filptr = strstr( str, "flt:" ); 
     
    19681971                } /*endif*/ 
    19691972        } else { 
     1973                /* if no filter found in the comment string it is an unfiltered trace */ 
    19701974                *filter = '\0'; 
    19711975        } /*endif*/ 
    19721976        strcpy( lfilname, filter ); 
    19731977 
     1978        /* if it is an unfiltered trace, take the transfer function of the recording 
     1979         * instrument.  This is returned by cu_lookup_filter. */ 
    19741980        if  (*lfilname == '\0')  { 
    19751981                locstat = cBcNoError; 
     
    19821988        } /*endif*/ 
    19831989 
    1984         /* build filter name & read amplitude */ 
     1990        /* if the trace is unfiltered or filtered with an simulation filter, the 
     1991         * transfer function is found by applying a prefix 'TF_VEL_' or 'TF_DSP_'. 
     1992         * Then this this contains the complete information needed here. 
     1993         * Build filter name & read amplitude */ 
    19851994        strcpy( str, "TF_" ); 
    19861995        strcat( str, kind ); 
     
    19881997        strcat( str, lfilname ); 
    19891998        tffac = ff_filter_amplitude( str, frq, status ); 
     1999 
     2000        /* if the filter cannot be found with a TF_VEL/DSP prefix it is not a 
     2001         * simulation filter, so we need the transfer function of the filter 
     2002         * and the transfer function of the recording instrument. 
     2003         */ 
     2004        if  (SySevere(status))  { 
     2005                /* at an unfiltered trace this means that the transfer function of the 
     2006                 * recording instrument has not been found before.  So nothing can 
     2007                 * be done here. */ 
     2008                if  (*lfilname == '\0')  return; 
     2009                *status = cBcNoError; 
     2010                /* get amplification of applied filter */ 
     2011                tffac = ff_filter_amplitude( lfilname, frq, status ); 
     2012                printf( "SHM-dbg2: fac1: filter applied: %s -> %f\n", lfilname, tffac ); 
     2013                if  (SySevere(status))  return; 
     2014                /* add transfer function of recording instrument (like code above) */ 
     2015                locstat = cBcNoError; 
     2016                db_gett( trcptr, ET_START, &ttime, &locstat ); 
     2017                tc_a2t( &ttime, strtime, &locstat ); 
     2018                cu_get_stream_string( trcptr, str, status ); 
     2019                if  (SySevere(status))  return; 
     2020                cu_lookup_filter( str, strtime, lfilname, &trcflags, status ); 
     2021                if  (SySevere(status))  return; 
     2022                strcpy( str, "TF_" ); 
     2023                strcat( str, kind ); 
     2024                strcat( str, "_" ); 
     2025                strcat( str, lfilname ); 
     2026                tffac2 = ff_filter_amplitude( str, frq, status ); 
     2027                printf( "SHM-dbg2: fac2: transfer function of rec. instr. %s -> %f\n", 
     2028                        str, tffac2 ); 
     2029                tffac *= tffac2; 
     2030        } /*endif*/ 
    19902031 
    19912032        if  (GpGetInt(cGpI_debug_level) > 1) 
Note: See TracChangeset for help on using the changeset viewer.