qff.comment = "qff" uff = NDG(ucont) uff.comment = "uff" invoke( "$KAPPA_DIR/ffclean in={0} out={1} box=3 clip=\[2,2,2\]" .format(qcont,qff) ) invoke( "$KAPPA_DIR/ffclean in={0} out={1} box=3 clip=\[2,2,2\]" .format(ucont,uff) ) # The next stuff we do independently for each subarray. qmos = {} umos = {} for a in ('S4A','S4B','S4C','S4D','S8A','S8B','S8C','S8D'): # Get an NDG object that contains the cleaned Q maps for the current # subarray. qarray = qcont.filter(a) # If any data was found for the current subarray... if qarray != None: # There seems to be a tendency for each bolometer to have its own fixed # bias in Q and U. We now try to remove these biases by removing the Q and # U values that are common to each image (as opposed to astronomical Q/U # variations, which are fixed on the sky and so will vary from image to # image as the focal plane is moved on the sky). First we find the mean Q # value in each bolometer by averaging the Q images, aligned in PIXEL (i.e. # bolomter) coords. The mean Q value per bolometer is put in qcom.sdf. msg_out( "Removing background Q level from {0} bolometers...".format(a)) qcom = NDG(1) qcom.comment = "qcom" invoke("$KAPPA_DIR/wcsframe {0} PIXEL".format(qarray))
if indata != fred: raise UsageError("\n\nThe directory specified by parameter RESTART ({0}) " "refers to different time-series data".format(restart) ) msg_out( "Re-using data in {0}".format(restart) ) # Initialise the starlink random number seed to a known value so that # results are repeatable. os.environ["STAR_SEED"] = "65" # Flat field the supplied template data ff = loadndg( "FF" ) if not ff: ff = NDG(indata) msg_out( "Flatfielding template data...") invoke("$SMURF_DIR/flatfield in={0} out={1}".format(indata,ff) ) ff = ff.filter() savendg( "FF", ff ) else: msg_out( "Re-using old flatfielded template data...") # If required, create new artificial I, Q and U maps. if newart: msg_out( "Creating new artificial I, Q and U maps...") # Get the parameters defining the artificial data ipeak = parsys["IPEAK"].value ifwhm = parsys["IFWHM"].value pol = parsys["POL"].value # Determine the spatial extent of the data on the sky. invoke("$SMURF_DIR/makemap in={0} out=! config=def".format(ff))
invoke("$POLPACK_DIR/polext in={0} angrot=90".format(uart) ) invoke("$KAPPA_DIR/setunits ndf={0} units=pW".format(iart) ) invoke("$KAPPA_DIR/setunits ndf={0} units=pW".format(qart) ) invoke("$KAPPA_DIR/setunits ndf={0} units=pW".format(uart) ) # If required, create an artificial common-mode (i.e. unpolarised emission # from the sky) for each sub-scan/grid-point. if incom: # First flat-field all the INCOM files. cff = NDG.load( "CFF" ) if not cff: cff = NDG(incom) msg_out( "Flatfielding common-mode data...") invoke("$SMURF_DIR/flatfield in={0} out={1}".format(incom,cff) ) cff = cff.filter() cff.save( "CFF" ) else: msg_out( "Re-using old flatfielded common-mode data...") # Process each sub-scan separately as they may have different lengths. cfactor = parsys["CFACTOR"].value com = NDG.load( "COM" ) if not com: msg_out( "Creating new artificial common-mode signals...") comlen = 0 totcom = NDG(1) lbnd = [] ubnd = []