original_docstring: 
          Mask out the spectrum between wlmin and wlmax. Saves to file the text needed
           to add to the synapps yaml.
          
docstring: Mask out the spectrum between wlmin and wlmax. Saves to file the text needed
  to add to the synapps yaml.
docstring_tokens: Mask out the spectrum between wlmin and wlmax . Saves to file the text needed to add to the synapps yaml .
code: def _mask(self, event):
          '''
          Mask out the spectrum between wlmin and wlmax. Saves to file the text needed
           to add to the synapps yaml.
          '''
          plt.sca( self.spec_ax )
          wlmins, wlmaxs = [],[]
          while True:
              print 'Click twice to mark the region to mask.'
              try:
                  [x1,y1],[x2,y2] = plt.ginput(2, timeout=60)
              except ValueError:
                  break
              wlmin = np.min([x1,x2])
              wlmax = np.max([x1,x2])
              wlmins.append(wlmin)
              wlmaxs.append(wlmax)
              # show that we've masked out some parts
              m = (self.spec[:,0] > wlmin) & (self.spec[:,0] < wlmax)
              plt.scatter(self.spec[:,0][m], self.spec[:,1][m], c='r', marker='x')
              plt.draw()
              inn = raw_input('\nHit "q" to continue, or enter for another mask\n')
              if 'q' in inn:
                  break
          # and now actually write to file the mask info
          applys = (('%10s,'%'Yes')*len(wlmins)).strip(',')
          weights = (('%10s,'%'0.00')*len(wlmins)).strip(',')
          lowers = ''.join( ['%10s,'%str(round(wl,2)) for wl in wlmins] ).strip(',')
          uppers = ''.join( ['%10s,'%str(round(wl,2)) for wl in wlmaxs] ).strip(',')
          output = """    regions      :
          apply    : [      Yes, %s ]
          weight   : [     1.00, %s ]
          lower    : [     0.00, %s ]
          upper    : [ 10000.00, %s ]
          """ %(applys, weights, lowers, uppers)
          open(self.yaml_file + '.regions','w').write(output)
          print 'Wrote to',self.yaml_file+'.regions'
code_tokens: def _mask ( self , event ) : plt . sca ( self . spec_ax ) wlmins , wlmaxs = [ ] , [ ] while True : print 'Click twice to mark the region to mask.' try : [ x1 , y1 ] , [ x2 , y2 ] = plt . ginput ( 2 , timeout = 60 ) except ValueError : break wlmin = np . min ( [ x1 , x2 ] ) wlmax = np . max ( [ x1 , x2 ] ) wlmins . append ( wlmin ) wlmaxs . append ( wlmax ) m = ( self . spec [ : , 0 ] > wlmin ) & ( self . spec [ : , 0 ] < wlmax ) plt . scatter ( self . spec [ : , 0 ] [ m ] , self . spec [ : , 1 ] [ m ] , c = 'r' , marker = 'x' ) plt . draw ( ) inn = raw_input ( '\nHit "q" to continue, or enter for another mask\n' ) if 'q' in inn : break applys = ( ( '%10s,' % 'Yes' ) * len ( wlmins ) ) . strip ( ',' ) weights = ( ( '%10s,' % '0.00' ) * len ( wlmins ) ) . strip ( ',' ) lowers = '' . join ( [ '%10s,' % str ( round ( wl , 2 ) ) for wl in wlmins ] ) . strip ( ',' ) uppers = '' . join ( [ '%10s,' % str ( round ( wl , 2 ) ) for wl in wlmaxs ] ) . strip ( ',' ) output = """    regions      :
          apply    : [      Yes, %s ]
          weight   : [     1.00, %s ]
          lower    : [     0.00, %s ]
          upper    : [ 10000.00, %s ]
          """ % ( applys , weights , lowers , uppers ) open ( self . yaml_file + '.regions' , 'w' ) . write ( output ) print 'Wrote to' , self . yaml_file + '.regions'
short_docstring: Mask out the spectrum between wlmin and wlmax.
short_docstring_tokens: Mask out the spectrum between wlmin and wlmax .
comment: '''
          Mask out the spectrum between wlmin and wlmax. Saves to file the text needed
           to add to the synapps yaml.
          '''$SEP$# show that we've masked out some parts$SEP$# and now actually write to file the mask info