Ignore:
Timestamp:
03/15/12 15:25:45 (12 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: Yes (CAS-2818)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: Added methods and functions
scantable.regrid_channel, scantable._regrid_specchan (defined in python_Scantable.cpp),
Scantable::regridSpecChannel, and ScantableWrapper::regridSpecChannel

Test Programs: comming soon with sdsmooth

Put in Release Notes: No

Module(s): scantable

Description:

Enabled regridding of spectra in a scantable.

scantable.regrid_channel(width, insitu=True/False?)

will do this.
width can be either in channel, frequency, or velocity unit.
verification is not available yet.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2431 r2435  
    23092309
    23102310    @asaplog_post_dec
     2311    def regrid_channel(self, width=5, plot=False, insitu=None):
     2312        """\
     2313        Regrid the spectra by the specified channel width
     2314
     2315        Parameters:
     2316
     2317            width:      The channel width (float) of regridded spectra
     2318                        in the current spectral unit.
     2319
     2320            plot:       [NOT IMPLEMENTED YET]
     2321                        plot the original and the regridded spectra.
     2322                        In this each indivual fit has to be approved, by
     2323                        typing 'y' or 'n'
     2324
     2325            insitu:     if False a new scantable is returned.
     2326                        Otherwise, the scaling is done in-situ
     2327                        The default is taken from .asaprc (False)
     2328
     2329        """
     2330        if insitu is None: insitu = rcParams['insitu']
     2331        varlist = vars()
     2332
     2333        if plot:
     2334           asaplog.post()
     2335           asaplog.push("Verification plot is not implemtnetd yet.")
     2336           asaplog.post("WARN")
     2337
     2338        s = self.copy()
     2339        s._regrid_specchan(width)
     2340
     2341        s._add_history("regrid_channel", varlist)
     2342
     2343#         if plot:
     2344#             from asap.asapplotter import new_asaplot
     2345#             theplot = new_asaplot(rcParams['plotter.gui'])
     2346#             theplot.set_panels()
     2347#             ylab=s._get_ordinate_label()
     2348#             #theplot.palette(0,["#777777","red"])
     2349#             for r in xrange(s.nrow()):
     2350#                 xsm=s._getabcissa(r)
     2351#                 ysm=s._getspectrum(r)
     2352#                 xorg=orgscan._getabcissa(r)
     2353#                 yorg=orgscan._getspectrum(r)
     2354#                 theplot.clear()
     2355#                 theplot.hold()
     2356#                 theplot.set_axes('ylabel',ylab)
     2357#                 theplot.set_axes('xlabel',s._getabcissalabel(r))
     2358#                 theplot.set_axes('title',s._getsourcename(r))
     2359#                 theplot.set_line(label='Original',color="#777777")
     2360#                 theplot.plot(xorg,yorg)
     2361#                 theplot.set_line(label='Smoothed',color="red")
     2362#                 theplot.plot(xsm,ysm)
     2363#                 ### Ugly part for legend
     2364#                 for i in [0,1]:
     2365#                     theplot.subplots[0]['lines'].append(
     2366#                         [theplot.subplots[0]['axes'].lines[i]]
     2367#                         )
     2368#                 theplot.release()
     2369#                 ### Ugly part for legend
     2370#                 theplot.subplots[0]['lines']=[]
     2371#                 res = raw_input("Accept smoothing ([y]/n): ")
     2372#                 if res.upper() == 'N':
     2373#                     s._setspectrum(yorg, r)
     2374#             theplot.quit()
     2375#             del theplot
     2376#             del orgscan
     2377
     2378        if insitu: self._assign(s)
     2379        else: return s
     2380
     2381    @asaplog_post_dec
    23112382    def _parse_wn(self, wn):
    23122383        if isinstance(wn, list) or isinstance(wn, tuple):
Note: See TracChangeset for help on using the changeset viewer.