Exemplo n.º 1
0
    def convert_to_measurement(self, dataArray):
        data = dataArray.data
        param = ScanningParam()
        param.filename = dataArray.info['filename']
        if dataArray.info['data_info'][0]['Name'] != 'Z':
            raise UnhandledFileError, \
                    'currently only topography is supported.'
        else:
            param.type = 'topo'
        n = dataArray.info['channel']
        if 0 == (n % 2):
            param.direction = 'Forward'
        elif 1 == (n % 2):
            if 'both' == dataArray.info['data_info'][n // 2 * 2 -
                                                     1]['Direction']:
                param.direction = 'Backward'
            else:
                param.direction = 'Forward'

        param.current = float(dataArray.info['z-controller']['Setpoint'].split(\
                                                                       ' ')[0])
        param.vgap = dataArray.info['bias']

        # BUG will not work for multichannel files:
        unit = dataArray.info['data_info'][0]['Unit']

        # For convenience scale units
        if param.type == 'topo' and unit == 'm':
            unit = u'nm'
            data = data * 1e9
        param.unit = unit
        param.creation_date = dataArray.info['rec_date']
        param.comment = dataArray.info['comment']

        axis1 = AxisParam()
        axis2 = AxisParam()
        axis3 = AxisParam()

        if param.type in ('topo', ):
            axis1.length = dataArray.info['scan_pixels'][0]
            axis1.unit = 'nm'
            axis1.increment = dataArray.info['scan_range'][
                0] / axis1.length * 1e9
            axis1.start = 0  # dataArray.info['scan_offset'][0] in meter

            axis2.length = dataArray.info['scan_pixels'][1]
            axis2.unit = 'nm'
            axis2.increment = dataArray.info['scan_range'][
                1] / axis2.length * 1e9
            axis2.start = 0

            param.axis1 = axis1
            param.axis2 = axis2

            print dataArray.info['scan_pixels']
            print dataArray.info['scan_range']

        return Measurement(data, param)
Exemplo n.º 2
0
    def convert_to_measurement(self, dataArray):
        data = dataArray.data
        param = ScanningParam()
        param.filename = dataArray.info["filename"]
        if dataArray.info["data_info"][0]["Name"] != "Z":
            raise UnhandledFileError, "currently only topography is supported."
        else:
            param.type = "topo"
        n = dataArray.info["channel"]
        if 0 == (n % 2):
            param.direction = "Forward"
        elif 1 == (n % 2):
            if "both" == dataArray.info["data_info"][n // 2 * 2 - 1]["Direction"]:
                param.direction = "Backward"
            else:
                param.direction = "Forward"

        param.current = float(dataArray.info["z-controller"]["Setpoint"].split(" ")[0])
        param.vgap = dataArray.info["bias"]

        # BUG will not work for multichannel files:
        unit = dataArray.info["data_info"][0]["Unit"]

        # For convenience scale units
        if param.type == "topo" and unit == "m":
            unit = u"nm"
            data = data * 1e9
        param.unit = unit
        param.creation_date = dataArray.info["rec_date"]
        param.comment = dataArray.info["comment"]

        axis1 = AxisParam()
        axis2 = AxisParam()
        axis3 = AxisParam()

        if param.type in ("topo",):
            axis1.length = dataArray.info["scan_pixels"][0]
            axis1.unit = "nm"
            axis1.increment = dataArray.info["scan_range"][0] / axis1.length * 1e9
            axis1.start = 0  # dataArray.info['scan_offset'][0] in meter

            axis2.length = dataArray.info["scan_pixels"][1]
            axis2.unit = "nm"
            axis2.increment = dataArray.info["scan_range"][1] / axis2.length * 1e9
            axis2.start = 0

            param.axis1 = axis1
            param.axis2 = axis2

            print dataArray.info["scan_pixels"]
            print dataArray.info["scan_range"]

        return Measurement(data, param)
Exemplo n.º 3
0
    def convert_to_measurement(self, dataArray):
        data = dataArray.data
        param = ScanningParam()
        param.filename = dataArray.info['filename']
        param.type = dataArray.info['type']
        param.direction = dataArray.info['direction']
        param.current = dataArray.info['current']
        param.vgap = dataArray.info['vgap']
        unit = dataArray.info['unit']
        # For convenience scale units
        if param.type == 'topo' and unit == 'm':
            unit = u'nm'
            data = data * 1e9
        elif param.type == 'ivcurve' and unit == 'A':
            unit = u'nA'
            data = data * 1e9
        elif param.type == 'ivmap' and unit == 'A':
            unit = u'nA'
            data = data * 1e9
        param.unit = unit
        param.creation_date = dataArray.info['date']
        param.comment = dataArray.info['comment']

        axis1 = AxisParam()
        axis2 = AxisParam()
        axis3 = AxisParam()

        if param.type in ('topo','ivmap'):
            axis1.length = dataArray.info['xres']
            axis1.unit = dataArray.info['unitxy']
            #axis1.length_physical = dataArray.info['xreal']
            axis1.increment = dataArray.info['xinc']
            axis1.start = 0

            axis2.length = dataArray.info['yres']
            axis2.unit = dataArray.info['unitxy']
            #axis2.length_physical = dataArray.info['yreal']
            axis2.increment = dataArray.info['yinc']
            axis2.start = 0

            param.axis1 = axis1
            param.axis2 = axis2

        if param.type in ('ivcurve','ivmap'):
            if param.type == 'ivcurve':
                axisv = axis1
                param.axis1 = axisv
            else:
                axisv = axis3
                param.axis3 = axisv
            axisv.unit = dataArray.info['unitv']
            coef = 1
            # For convenience scale units
            if axisv.unit == 'V':
                axisv.unit = 'mV'
                coef = 1e3
            axisv.length = dataArray.info['vres']
            #axisv.length_physical = dataArray.info['vreal'] * coef
            axisv.increment = dataArray.info['vinc'] * coef
            axisv.start = dataArray.info['vstart'] * coef

        return Measurement(data, param)
Exemplo n.º 4
0
    def convert_to_measurement(self, dataArray):
        data = dataArray.data
        param = ScanningParam()
        param.filename = dataArray.info["filename"]
        param.type = dataArray.info["type"]
        param.direction = dataArray.info["direction"]
        param.current = dataArray.info["current"]
        param.vgap = dataArray.info["vgap"]
        unit = dataArray.info["unit"]
        # For convenience scale units
        if param.type == "topo" and unit == "m":
            unit = u"nm"
            data = data * 1e9
        elif param.type == "ivcurve" and unit == "A":
            unit = u"nA"
            data = data * 1e9
        elif param.type == "ivmap" and unit == "A":
            unit = u"nA"
            data = data * 1e9
        param.unit = unit
        param.creation_date = dataArray.info["date"]
        param.comment = dataArray.info["comment"]

        axis1 = AxisParam()
        axis2 = AxisParam()
        axis3 = AxisParam()

        if param.type in ("topo", "ivmap"):
            axis1.length = dataArray.info["xres"]
            axis1.unit = dataArray.info["unitxy"]
            # axis1.length_physical = dataArray.info['xreal']
            axis1.increment = dataArray.info["xinc"]
            axis1.start = 0

            axis2.length = dataArray.info["yres"]
            axis2.unit = dataArray.info["unitxy"]
            # axis2.length_physical = dataArray.info['yreal']
            axis2.increment = dataArray.info["yinc"]
            axis2.start = 0

            param.axis1 = axis1
            param.axis2 = axis2

        if param.type in ("ivcurve", "ivmap"):
            if param.type == "ivcurve":
                axisv = axis1
                param.axis1 = axisv
            else:
                axisv = axis3
                param.axis3 = axisv
            axisv.unit = dataArray.info["unitv"]
            coef = 1
            # For convenience scale units
            if axisv.unit == "V":
                axisv.unit = "mV"
                coef = 1e3
            axisv.length = dataArray.info["vres"]
            # axisv.length_physical = dataArray.info['vreal'] * coef
            axisv.increment = dataArray.info["vinc"] * coef
            axisv.start = dataArray.info["vstart"] * coef

        return Measurement(data, param)