Esempio n. 1
0
    def get_import_spec(self, name):

        spec = ImportSpec()

        i = Irradiation()
        i.name = name

        spec.irradiation = i

        i.doses = self._get_doses(name)

        nlevels = []

        dm = self._dm
        sheet = dm.get_sheet(('Irradiations', 0))
        nameidx = dm.get_column_idx(NAME, sheet)
        levelidx = dm.get_column_idx(LEVEL, sheet)
        pridx = dm.get_column_idx(PR, sheet)
        holderidx = dm.get_column_idx(HOLDER, sheet)
        zidx = dm.get_column_idx(Z, sheet)
        noteidx = dm.get_column_idx(NOTE, sheet)

        z = 0
        for row in dm.iterrows(sheet, start=1):
            if row[nameidx].value == name:
                level = Level()
                level.name = row[levelidx].value
                level.z = row[zidx].value or z
                z = level.z + 1
                level.note = row[noteidx].value

                prod = Production()
                prod.name = row[pridx].value
                level.production = prod
                level.holder = row[holderidx].value

                pos = self._get_positions(name, level.name)
                level.positions = pos
                nlevels.append(level)

        i.levels = nlevels
        return spec
Esempio n. 2
0
    def get_import_spec(self, name):

        spec = ImportSpec()

        i = Irradiation()
        i.name = name

        spec.irradiation = i

        i.doses = self._get_doses(name)

        nlevels = []

        dm = self._dm
        sheet = dm.get_sheet(('Irradiations', 0))
        nameidx = dm.get_column_idx(NAME, sheet)
        levelidx = dm.get_column_idx(LEVEL, sheet)
        pridx = dm.get_column_idx(PR, sheet)
        holderidx = dm.get_column_idx(HOLDER, sheet)
        zidx = dm.get_column_idx(Z, sheet)
        noteidx = dm.get_column_idx(NOTE, sheet)

        z = 0
        for row in dm.iterrows(sheet, start=1):
            if row[nameidx].value == name:
                level = Level()
                level.name = row[levelidx].value
                level.z = row[zidx].value or z
                z = level.z + 1
                level.note = row[noteidx].value

                prod = Production()
                prod.name = row[pridx].value
                level.production = prod
                level.holder = row[holderidx].value

                pos = self._get_positions(name, level.name)
                level.positions = pos
                nlevels.append(level)

        i.levels = nlevels
        return spec
Esempio n. 3
0
    def get_import_spec(self, name):
        from pychron.entry.import_spec import ImportSpec, Irradiation, Level, \
            Sample, Project, Position, Production
        spec = ImportSpec()

        i = Irradiation()
        i.name = name

        spec.irradiation = i

        chrons = self.get_chronology_by_irradname(name)
        i.doses = [(1.0, ci.StartTime, ci.EndTime) for ci in chrons]

        levels = self.get_irradiation_levels(name)
        nlevels = []
        for dbl in levels:
            level = Level()
            level.name = dbl.Level

            prod = Production()
            dbprod = dbl.production
            prod.name = dbprod.Label.replace(' ', '_')

            for attr in INTERFERENCE_KEYS:
                try:
                    setattr(prod, attr, (getattr(
                        dbprod, attr), getattr(dbprod, '{}Er'.format(attr))))
                except AttributeError:
                    pass

            prod.Ca_K = (dbprod.CaOverKMultiplier, dbprod.CaOverKMultiplierEr)
            prod.Cl_K = (dbprod.ClOverKMultiplier, dbprod.ClOverKMultiplierEr)
            prod.Cl3638 = (dbprod.P36Cl38Cl, dbprod.P36Cl38ClEr)

            level.production = prod
            level.holder = dbl.SampleHolder

            pos = []
            for ip in self.get_irradiation_positions(name, level.name):
                dbsam = ip.sample
                s = Sample()
                s.name = dbsam.Sample
                s.material = ip.Material

                pp = Project()
                pp.name = ip.sample.project.Project
                pp.principal_investigator = ip.sample.project.PrincipalInvestigator
                s.project = pp

                p = Position()
                p.sample = s
                p.position = ip.HoleNumber
                p.identifier = ip.IrradPosition
                p.j = ip.J
                p.j_err = ip.JEr
                p.note = ip.Note
                p.weight = ip.Weight

                pos.append(p)
            level.positions = pos
            nlevels.append(level)

            i.levels = nlevels
        return spec
Esempio n. 4
0
    def get_import_spec(self, name):
        from pychron.entry.import_spec import ImportSpec, Irradiation, Level, \
            Sample, Project, Position, Production
        spec = ImportSpec()

        i = Irradiation()
        i.name = name

        spec.irradiation = i

        with self.session_ctx():
            chrons = self.get_chronology_by_irradname(name)
            i.doses = [(1.0, ci.StartTime, ci.EndTime) for ci in chrons]

            levels = self.get_irradiation_levels(name)
            nlevels = []
            for dbl in levels:
                level = Level()
                level.name = dbl.Level

                prod = Production()
                dbprod = dbl.production
                prod.name = dbprod.Label.replace(' ', '_')

                for attr in INTERFERENCE_KEYS:
                    try:
                        setattr(prod, attr, (getattr(dbprod, attr),
                                             getattr(dbprod, '{}Er'.format(attr))))
                    except AttributeError:
                        pass

                prod.Ca_K = (dbprod.CaOverKMultiplier, dbprod.CaOverKMultiplierEr)
                prod.Cl_K = (dbprod.ClOverKMultiplier, dbprod.ClOverKMultiplierEr)
                prod.Cl3638 = (dbprod.P36Cl38Cl, dbprod.P36Cl38ClEr)

                level.production = prod
                level.holder = dbl.SampleHolder

                pos = []
                for ip in self.get_irradiation_positions(name, level.name):
                    dbsam = ip.sample
                    s = Sample()
                    s.name = dbsam.Sample
                    s.material = ip.Material

                    pp = Project()
                    pp.name = ip.sample.project.Project
                    pp.principal_investigator = ip.sample.project.PrincipalInvestigator
                    s.project = pp

                    p = Position()
                    p.sample = s
                    p.position = ip.HoleNumber
                    p.identifier = ip.IrradPosition
                    p.j = ip.J
                    p.j_err = ip.JEr
                    p.note = ip.Note
                    p.weight = ip.Weight

                    pos.append(p)
                level.positions = pos
                nlevels.append(level)

            i.levels = nlevels
        return spec