def __init__(self, framestream, display_defaults, framedomain=None, instrument=None, figurecontainer=None): super(dpl_met_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer self.instrument = instrument if instrument != None else 'Met' self.framestream = framestream self.framedomain = framedomain import met.graphics.met_display as rd self.rd = rd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()
def __init__(self, framestream, display_defaults, instrument=None, figurecontainer=None, subframe='rs_mmcr'): super(dpl_radar_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer if instrument is None: print 'WARNING: RADAR Type not specified at init! Might not be right if multiple radar streams given' self.instrument = instrument or (framestream.radarType if hasattr( framestream, 'radarType') else 'Radar') self.framestream = framestream self.subframe = subframe import radar.graphics.radar_display as rd self.rd = rd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()
def __init__(self, framestream, display_defaults, figurecontainer=None, subframe=None, streamname=None): super(dpl_raman_inverted_profile_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer self.instrument = self.platform + '-' + (streamname or self.ramanType ) #self.ramanType self.framestream = framestream self.subframe = subframe import raman.graphics.raman_display as rd self.rd = rd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer is None: self.figcontainer = self.gt.figurelist()
def __init__(self, framestream, display_defaults, subframe=None, figurecontainer=None, includenestedframes={}): super(dpl_allradar_hsrl_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer self.subframename = subframe self.framestream = framestream self.includenestedframes = includenestedframes import cooperative.hsrl_radar.radar_hsrl_display as rhd self.rhd = rhd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()
def __init__(self, framestream, display_defaults, subframe='rs_multiple_scattering', figurecontainer=None, includenestedframes={}): super(dpl_multiple_scattering_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer try: self.instrument = getattr(self.framestream, 'multiple_scattering_instrument') except: self.instrument = 'Multiple Scattering' self.subframename = subframe self.framestream = framestream self.includenestedframes = includenestedframes import cooperative.graphics.multiple_scattering_display as msd self.msd = msd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()
def reload_process_control(self): if self.process_control_file is not None: self.process_control = jc.json_config( locate_file(self.process_control_file, systemOnly=self.system_config), 'process_defaults') if self.system_config and os.getenv('OVERRIDE_SYSTEM_DEFAULTS', None) is None: altpath = self.process_control.get_value('alternate_cal_dir', 'full_dir_path') if not (altpath is None or altpath == "None"): print "System Default process_defaults.json should not specify an alternative calibration path." hconfig = os.getenv( "HSRL_CONFIG", "a custom location, set HSRL_CONFIG to that path") print "Strongly recommended one of the two options:" print "- copy process_defaults.json to %s, customize the json there, and specify this non-default parameter at the commandline" % ( hconfig) print "- or set HSRL_ALTERNATE_CAL_DIR to %s" % (altpath) print "Or, alternatively, do all of the following:" print "set OVERRIDE_SYSTEM_DEFAULTS to yes" if "custom location" in hconfig: hconfig = "~/hsrl_config" print "make directory " + hconfig print "set HSRL_CONFIG to " + hconfig print "copy process_defaults.json to " + hconfig print "modify it without renaming it, and it becomes the new system default for you"
def maybeMakeJC(displays, majorkey, *args, **kwargs): """ Attempt to make a json_config object from a display and majorkey (required subsection used as default) if the first parameter is a string, an attempt to locate it will be made. if this fails, the string will be returned as-is if this succeeds, the resulting json_config is loaded if its not a string, it will be treated like a dictionary for a json_config initialization if the loading above fails because the major key is missing, the located string or dictionary is returned as is if it fails for another reason, the exception as to why is raised """ if majorkey is not None and not isinstance(displays, jc.json_config): jsd = rip_json_config_parameters(kwargs) try: if isinstance(displays, basestring): try: displays = lf.locate_file( displays, **only_locate_file_parameters(kwargs)) except IOError: return displays #if its located or is not a string, try loading as a json_config return jc.json_config(displays, majorkey, **jsd) except KeyError: pass except ValueError: if displays.endswith('.json'): raise return displays
def __init__(self, platform, timeinfo, process_control, corr_adjusts=None): super(dpl_constants_narr, self).__init__(timeinfo, cru.cal_file_reader(platform)) self.platform = platform self.rprocess_control = process_control if self.rprocess_control is None: self.rprocess_control = 'raman_process_control.json' if isinstance(self.rprocess_control, basestring): import lg_base.core.locate_file as lf import lg_base.core.json_config as jc self.rprocess_control = jc.json_config( lf.locate_file(self.rprocess_control, systemOnly=False), 'raman_process_defaults') self.rcorr_adjusts = self.rprocess_control.get_dict( 'corr_adjusts').copy() if corr_adjusts != None: self.rcorr_adjusts.update(corr_adjusts)
def __init__(self, framestream, max_alt, display_defaults, instrument=None, processing_defaults=None, figurecontainer=None, limit_frame_to=None, breakup_nesting=False, flat_frame=False, enable_masking=None): super(dpl_images_artist, self).__init__(framestream) self.framestream = framestream #self.provides=framestream.provides self.instrument = instrument or framestream.hsrl_instrument self.max_alt = max_alt self.enable_masking = enable_masking try: self.processing_defaults = processing_defaults or framestream.hsrl_process_control except: self.processing_defaults = None self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.limit_frame_to = limit_frame_to self.breakup_nesting = breakup_nesting self.flat_frame = flat_frame import lg_base.graphics.graphics_toolkit as gt self.gt = gt #import hsrl.data_stream.display_utilities as du import hsrl.graphics.hsrl_display as du self.du = du self.stepper = None self.figcontainer = figurecontainer or self.gt.figurelist()
def __init__(self, framestream, display_defaults, subframes, figurecontainer=None): super(dpl_profiles_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer self.subframenames = subframes self.framestream = framestream import cooperative.graphics.profiles_display as rd self.rd = rd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()
def __init__(self, framestream, display_defaults, subframe=None, mode='mass_dimension', figurecontainer=None, includenestedframes={}): super(dpl_particle_images_artist, self).__init__(framestream) self.display_defaults = display_defaults if isinstance(display_defaults, basestring): self.display_defaults = jc.json_config( lf.locate_file(display_defaults), 'display_defaults', allow_missing_values=True) self.figcontainer = figurecontainer self.subframename = subframe self.framestream = framestream self.includenestedframes = includenestedframes self.mode = mode if mode not in ('spheroid', 'mass_dimension'): raise NotImplementedError('Particle image generation mode for ' + mode) instname = mode + '_instrument' if hasattr(self, instname): self.instrument = getattr(self, instname) else: self.instrument = mode import cooperative.graphics.coop_display as rd self.rd = rd import lg_base.graphics.graphics_toolkit as gt self.gt = gt #if isinstance(self.display_defaults,basestring): # [self.display_defaults, dummy]= du.get_display_defaults(self.display_defaults,"new") self.stepper = None if self.figcontainer == None: self.figcontainer = self.gt.figurelist()