# Load the scantable for the source into ASAP mon=scantable('mon.asap') mon.summary() # Select the on-source scans source=mon.get_scan([1,3]) # Select the reference scans ref=mon.get_scan([0,2]) # Make the quotient spectra and plot it quot=quotient(source,ref) plotter.plot(quot) # Remove the baseline and plot quot.auto_poly_baseline() plotter.plot(quot) # Average the 2 scans together av=quot.average_time(align=True) plotter.plot(av) # Check the the rest frequency is set correctly and define unit as km/s av.get_restfreqs() av.set_unit('km/s') plotter.plot(av) # Scale the two polarizations separately sel=selector() sel.set_polarisations(0) av.set_selection(sel) av.scale(50.6) sel.set_polarisations(1) av.set_selection(sel) av.scale(32.5) # Average the polarizations together avpol=av.average_pol() # Plot the data plotter.plot(avpol) # Create a mask that contains the emission msk=avpol.create_mask([-10,30]) # Set up some fitting parameters f=fitter() f.set_scan(avpol,msk) f.set_function(gauss=2) # Fit a gaussian to the emission, plot the emission and fit f.fit() f.plot() # Save the plot plotter.save('monr2.eps') # Get the fit parameters f.get_parameters() # Plot the fit residuals f.plot(residual=True) # Plot each of the fitted gaussians separately, with or without the fit parameters overlaid f.plot(components=0,plotparms=True) f.plot(components=1) #ADVANCED fitting: forcing gaussian component, eg f.set_gauss_parameters(39, 10.2, 1, peakfixed=1, component=0) #get the rms noise in the spectrum msk2=avpol.create_mask([-80,5],[15,140]) avpol.stats(stat='rms',mask=msk2)