# write spectrum to file that has been integrated over
# rectangular region, using only pixels with non-negative values.
# if the log file already exists, overwrite it with the new data.
specflux(imagename="my.im", box="10,10,45,50", mask="my.im>=0", unit="km/s", logfile="my.log", overwrite=True)

# Extract the spectral profile using "sum" as the aggregate function from a cube over a given region:
specflux(imagename="myimage.image", box="10,10,45,50", mask="my.im>=0", function="sum", unit="km/s", logfile="profile.log", overwrite=True)

# Calculate the integrated line flux over a given region and channel range
# (this value will be reported as "Total Flux" in the output of specflux)
specflux(imagename="myimage.image", region="myregion.crtf", chans="14~25", unit="km/s", logfile="integrated_line_flux.log", overwrite=True)