Beispiel #1
0
 def do_fetch(self):
     if pyfusion.DBG() > 2: print('in fetch',self.diag_name, self)
     debug_(pyfusion.DEBUG, level=3, key='igetfile_fetch')
     diag = self.config_name
     infodict = eval(eval(self.info))
     vardict = get_basic_diagnostics(diags=[diag], times=None, shot=self.shot,
                                     file_info={diag:infodict}, debug=1, 
                                     exception=None)
     debug_(pyfusion.DEBUG, level=2, key='after get_basic')
       
     output_data = TimeseriesData(timebase=Timebase(vardict['check_tm']),
                                  signal=Signal(vardict[self.config_name]),
                                  channels=Channel(self.config_name,Coords('dummy',(0,0,0))))
     output_data.config_name = self.config_name  # ??? bdb - my fault?
     return output_data
Beispiel #2
0
if len(shot_list) == 0:
    shots = np.unique(dd['shot'])
    wgt = where((shots >= minshot) & (shots <= maxshot))
    shot_list = shots[wgt]

for shot in shot_list:
    # ws is the set of indices corresponding to the shot
    ws = np.where(shot == dd['shot'])[0]
    if len(ws) == 0:  # this is an impossible condition!
        raise LookupError(
            'Impossible! could not find the expected shot {0}'.format(shot))
    else:
        try:
            times = dd['t_mid'][ws]
            basic_data = get_basic_diagnostics(diags, shot=shot, times=times)
            (tstart, tend, inds) = get_flat_top(times=None,
                                                shot=shot)  # None important
            flat_level = times * 0
            w = np.where((times > tstart) & (times < tend))[0]
            flat_level[w] = 1.0
            if debug > 0: print("len = {0}".format(len(w)))
            basic_data.update({'flat_level': flat_level})

            good_shots.append(shot)
        except exception, details:
            missing_shots.append(shot)
            basic_data = {}
            pyfusion.logging.warning(
                "shot {s} not processed for diags, {info}".format(
                    s=shot, info=details))
 
if len(shot_list)==0:
    shots = np.unique(dd['shot'])
    wgt = np.where((shots >= minshot) & (shots <= maxshot))
    shot_list = shots[wgt]

for shot in shot_list:
    # ws is the set of indices corresponding to the shot
    ws = np.where(shot == dd['shot'])[0]
    if len(ws)==0:   # this is an impossible condition!
       raise LookupError('Impossible! could not find the expected shot {0}'.
                         format(shot))
    else: 
       try:
          times = dd['t_mid'][ws]
          basic_data = get_basic_diagnostics(diags,shot=shot,times=times)
          if 'w_p' in diags:  # omit all this if not asked for w_p (to make sure we get Bo)
              (tstart,tend,inds) = get_flat_top(times=None, shot=shot) # None important
              flat_level = times*0
              w=np.where((times>tstart) & (times<tend))[0]
              flat_level[w] = 1.0
              if debug>0: print("len = {0}".format(len(w)))
              basic_data.update({'flat_level': flat_level})

          good_shots.append(shot)
       except exception as details:		
          missing_shots.append(shot)
          basic_data={}
          pyfusion.logging.warning("shot {s} not processed for diags, {info} {a}"
                                   .format(s=shot, info=details, u=details.args))