code: def getnoisefile(d, segment=-1):
      
      if d.has_key('segment'):
          return os.path.join(d['workdir'], 'noise_' + d['fileroot'] + '_sc' + str(d['scan']) + 'seg' + str(d['segment']) + '.pkl')
      elif segment >= 0:
          return os.path.join(d['workdir'], 'noise_' + d['fileroot'] + '_sc' + str(d['scan']) + 'seg' + str(segment) + '.pkl')
      else:
          return ''
docs: Return name of noisefile for a given dictionary. Must have d['segment'] defined.