Ejemplo n.º 1
0
def parse_from_image_measurements(parser_image_measurements, testconf, args):

    # imgMeasureFile = testconf.folder.image / 'processed' / (testconf.info.name + '.measurements.json')
    imgMeasureFile = testconf.folder.images / 'processed' / 'data.json'
    imgMeasureFile = imgMeasureFile.resolve()
    
    imgMeasurements = Json.load_json(imgMeasureFile.parent.as_posix(), json_url=imgMeasureFile.name)
    # debug(imgMeasurements)
    
    data = parser_image_measurements(testconf, imgMeasurements)

    return data
Ejemplo n.º 2
0
def parse_from_image_measurements(parser_image_measurements, testconf, args):

    # imgMeasureFile = testconf.folder.image / 'processed' / (testconf.info.name + '.measurements.json')
    imgMeasureFile = testconf.folder.images / 'processed' / 'data.json'
    imgMeasureFile = imgMeasureFile.resolve()

    imgMeasurements = Json.load_json(imgMeasureFile.parent.as_posix(),
                                     json_url=imgMeasureFile.name)
    # debug(imgMeasurements)

    data = parser_image_measurements(testconf, imgMeasurements)

    return data
Ejemplo n.º 3
0
    def run_preconditions(self):
        if not self.current_item or not self.current_testinfo:
            return

        import scilab.graphs.precondition_fitting as precondition_fitting

        testinfo = self.current_testinfo
        testfolder = self.testfs.testfolder(testinfo=testinfo,
                                            ensure_folders_exists=False)

        # if not self._test_measurements.area and not self._test_measurements.gauge:
        self.run_enterdata()

        area_diff = abs(self._test_measurements.min_area -
                        self._test_measurements.area)
        area_min = self._test_measurements.min_area
        N = 5 if area_diff > 1E-3 else 1

        results = "# Preconds: \n"
        results += str(self._test_measurements) + "\n"

        for a in np.linspace(self._test_measurements.min_area,
                             self._test_measurements.area, N):

            print("#### run_preconditions Area:", a)
            # self.updateInfoPane("\nArea:"+str(a)+"\n")

            measures = DataTree(area=a, gauge=self._test_measurements.gauge)

            measurements = precondition_fitting.process_test(
                testinfo, testfolder, measures)

            data = Json.load_json(testfolder.jsoncalc,
                                  json_url=testinfo.name +
                                  '.preconds.calculated.json')

            #results += '\n\n## Preconds area: %5.4f\n\n'%(a)
            # results += '\n'.join( "%s = %s"%i for i in sorted(flatten(data).items()) if '3third' in i[0] )

            results += '\n %6.4f, %6.4f \n' % (
                measures.area, data['dynmodfits']['3third']['value'])

        self.updateInfoPane(results)
Ejemplo n.º 4
0
    def run_preconditions(self):
        if not self.current_item or not self.current_testinfo:
            return

        import scilab.graphs.precondition_fitting as precondition_fitting 

        testinfo = self.current_testinfo
        testfolder = self.testfs.testfolder(testinfo=testinfo, ensure_folders_exists=False)

        # if not self._test_measurements.area and not self._test_measurements.gauge:
        self.run_enterdata()

        area_diff = abs(self._test_measurements.min_area-self._test_measurements.area)
        area_min = self._test_measurements.min_area
        N = 5 if area_diff > 1E-3 else 1
        
        results = "# Preconds: \n"
        results += str(self._test_measurements) + "\n"
        
        for a in np.linspace(self._test_measurements.min_area, self._test_measurements.area, N):
            
            print("#### run_preconditions Area:", a)
            # self.updateInfoPane("\nArea:"+str(a)+"\n")

            measures = DataTree(area=a, gauge=self._test_measurements.gauge)

            measurements = precondition_fitting.process_test(testinfo, testfolder, measures)

            data = Json.load_json(testfolder.jsoncalc, json_url=testinfo.name+'.preconds.calculated.json')

            #results += '\n\n## Preconds area: %5.4f\n\n'%(a) 
            # results += '\n'.join( "%s = %s"%i for i in sorted(flatten(data).items()) if '3third' in i[0] )

            results += '\n %6.4f, %6.4f \n'%( measures.area, data['dynmodfits']['3third']['value'])
            
        self.updateInfoPane(results)
Ejemplo n.º 5
0
 def getJson(subcalc):
     debug(subcalc.name)
     return Json.load_json(subcalc.parent.as_posix(), json_url=subcalc.name)
Ejemplo n.º 6
0
def print_datasheet(testinfo, testfolder, report):
    
    print(mdHeader(3, "DataSheet Info" ), file=report)
    details = Json.load_json(testfolder.json, json_url=testinfo.name+'.calculated.json') 

    # debug(details)
    fdetails = flatten(details, sep='.')
    # debug(fdetails)


    name = OrderedDict()
    # name["Short Name"] = "Short Name"
    # name["info.name"] = "info.name"
    # name["linear_modulus.value"] = "Toe Linear Modulus"
    # name["linear_modulus.slope_strain"] = "TLM Strain Slope"
    # name["linear_modulus.slope_stress"] = "TLM Stress Slope"
    # name["calculations.maxes.displacement.value"] = "displacement.value"
    # name["calculations.maxes.load.value"] = "load.value"
    # name["calculations.maxes.strain.value"] = "strain.value"
    # name["calculations.maxes.stress.value"] = "stress.value"
    name["measurements.area.units"] = "area.units"
    name["measurements.area.value"] = "area.value"
    name["measurements.depth.stdev"] = "depth.stdev"
    name["measurements.depth.value"] = "depth.value"
    name["measurements.width.stdev"] = "width.stdev"
    name["measurements.width.value"] = "width.value"
    name["gauge.base"] = "gauge.base"
    name["gauge.preloaded"] = "gauge.preloaded"
    name["gauge.value"] = "gauge.value"
    # name["info.sample"] = "info.sample"
    # name["info.layer"] = "info.layer"
    # name["info.orientation"] = "info.orientation"
    # name["info.wedge"] = "info.wedge"
    # name["info.side"] = "info.side"
    # name["info.set"] = "info.set"
    # name["info.date"] = "info.date"
    # name["info.run"] = "info.run"
    # name["name"] = "File Name"

    for k,v in name.items():
        v = v.replace('.value','').split('.')
        name[k] = ' '.join( [ s[0].upper()+s[1:] for s in v ] )

    

    # print(*name.values(),sep='\n')
    # make table
    def values(v):
        try:
            if type(v) == float:
                return "%.3f"%v
            elif type(v) == int:
                return "%d"%v
        except:
            return v
        
    data =  [ (k, values(fdetails.get(k,None))) for k in name ]

    # debug(data)
    
    print(tabulate(data, headers=['Name', 'Value'], numalign="right", floatfmt=".2f"), file=report)

    return details
Ejemplo n.º 7
0
 def getJson(subcalc):
     debug(subcalc.name)
     return Json.load_json(subcalc.parent.as_posix(), json_url=subcalc.name)
Ejemplo n.º 8
0
def print_datasheet(testinfo, testfolder, report):

    print(mdHeader(3, "DataSheet Info"), file=report)
    details = Json.load_json(testfolder.json,
                             json_url=testinfo.name + '.calculated.json')

    # debug(details)
    fdetails = flatten(details, sep='.')
    # debug(fdetails)

    name = OrderedDict()
    # name["Short Name"] = "Short Name"
    # name["info.name"] = "info.name"
    # name["linear_modulus.value"] = "Toe Linear Modulus"
    # name["linear_modulus.slope_strain"] = "TLM Strain Slope"
    # name["linear_modulus.slope_stress"] = "TLM Stress Slope"
    # name["calculations.maxes.displacement.value"] = "displacement.value"
    # name["calculations.maxes.load.value"] = "load.value"
    # name["calculations.maxes.strain.value"] = "strain.value"
    # name["calculations.maxes.stress.value"] = "stress.value"
    name["measurements.area.units"] = "area.units"
    name["measurements.area.value"] = "area.value"
    name["measurements.depth.stdev"] = "depth.stdev"
    name["measurements.depth.value"] = "depth.value"
    name["measurements.width.stdev"] = "width.stdev"
    name["measurements.width.value"] = "width.value"
    name["gauge.base"] = "gauge.base"
    name["gauge.preloaded"] = "gauge.preloaded"
    name["gauge.value"] = "gauge.value"
    # name["info.sample"] = "info.sample"
    # name["info.layer"] = "info.layer"
    # name["info.orientation"] = "info.orientation"
    # name["info.wedge"] = "info.wedge"
    # name["info.side"] = "info.side"
    # name["info.set"] = "info.set"
    # name["info.date"] = "info.date"
    # name["info.run"] = "info.run"
    # name["name"] = "File Name"

    for k, v in name.items():
        v = v.replace('.value', '').split('.')
        name[k] = ' '.join([s[0].upper() + s[1:] for s in v])

    # print(*name.values(),sep='\n')
    # make table
    def values(v):
        try:
            if type(v) == float:
                return "%.3f" % v
            elif type(v) == int:
                return "%d" % v
        except:
            return v

    data = [(k, values(fdetails.get(k, None))) for k in name]

    # debug(data)

    print(tabulate(data,
                   headers=['Name', 'Value'],
                   numalign="right",
                   floatfmt=".2f"),
          file=report)

    return details