def _make_template_table(self):
     template_list = get_all_templates(apikey=self.apikey)
     table = {}
     for template in template_list:
         self.log.debug("Init Template entry for {}".format(template.id))
         table[template.id] = template
     self.template_table = table
예제 #2
0
    def do_some_api_work(self):
        project_name = self.fake_name("TestApikeyProject-")
        self.log.info(project_name)
        description = "Test project generated by automated test"
        project = create_project(project_name, description)
        self.log.info("project owner = {}, worker apikey = {}".format(
            project.owner, self.apikey))
        experiment_name = self.fake_name("TestApikeyExperiment-")
        description = "Test experiment generated by automated test"
        experiment = project.create_experiment(experiment_name, description)

        template_table = self.make_template_table(get_all_templates())

        create_template = self.find_template_id_from_match(
            template_table, "Create Sample")
        create_process = experiment.create_process_from_template(
            create_template)

        ht_template = self.find_template_id_from_match(template_table,
                                                       "Heat Treatment")
        ht_process = experiment.create_process_from_template(ht_template)

        process_list = project.get_all_processes()
        found1 = None
        found2 = None
        for process in process_list:
            if create_process.id == process.id:
                found1 = process
            if ht_process.id == process.id:
                found2 = process
        if found1:
            self.log.info("found process {}".format(found1.name))
        else:
            self.log.info("did not find 'create samples' process")
        if found2:
            self.log.info("found process {}".format(found2.name))
        else:
            self.log.info("did not find 'heat treatment' process")
예제 #3
0
     pyxl.styles.colors.Color('A52A2A'),  # 7. Brown
     pyxl.styles.colors.Color('DEB887'),  # 8. BurlyWood
     pyxl.styles.colors.Color('5F9EA0'),  # 9. CadetBlue
     pyxl.styles.colors.Color('7FFF00'),  # 10. Chartreuse
     pyxl.styles.colors.Color('D2691E'),  # 11. Chocolate
     pyxl.styles.colors.Color('FFB6C1'),  # 12. LightPink
     pyxl.styles.colors.Color('6495ED'),  # 13. CornflowerBlue
     pyxl.styles.colors.Color('FFF8DC'),  # 14. Cornsilk
     pyxl.styles.colors.Color('FFA07A'),  # 15. LightSalmon
 ]
 cell_fills = []
 for color in colors:
     cell_fills.append(
         pyxl.styles.fills.PatternFill(patternType='solid', fgColor=color))
 fills_len = len(cell_fills)
 templates = get_all_templates()
 wb = pyxl.Workbook()
 ws = wb.active
 ws.title = 'Templates'
 ws.append([
     'Index', 'Template Name', 'Type', 'Description', 'Transforms Sample',
     'Destructive', 'temp1'
 ])
 current_fill_index = 0
 dv = pyxl.worksheet.datavalidation.DataValidation(
     type="list", formula1="temp1,temp2,temp3", allow_blank=True)
 dv.error = "You entry not in list"
 dv.errorTitle = "Invalid error"
 dv.prompt = "Please select from temperature list"
 dv.promptTitle = "Temperature Selection"
 ws.add_data_validation(dv)
예제 #4
0
#import sys

import materials_commons.api as mcapi

project_list = mcapi.get_all_projects()

for project in project_list:
    if project.name == 'PRISMS-PF API Test':
        current_project = project

experiment_list = current_project.get_all_experiments()

for experiment in experiment_list:
    if experiment.name == 'Experiment 0':
        print(experiment.name)
        current_experiment = experiment


template_list = mcapi.get_all_templates()
for template in template_list:
    print(template.name, template.id)

#experiment = project.create_experiment("Experiment 0", "Creating and modifying experiments using the API")
예제 #5
0
    colors.append(wb.add_format({'bg_color': 'B0C4DE'}))  # 6. LightSteelBlue
    colors.append(wb.add_format({'bg_color': 'A52A2A'}))  # 7. Brown
    colors.append(wb.add_format({'bg_color': 'DEB887'}))  # 8. BurlyWood
    colors.append(wb.add_format({'bg_color': '5F9EA0'}))  # 9. CadetBlue
    colors.append(wb.add_format({'bg_color': '7FFF00'}))  # 10. Chartreuse
    colors.append(wb.add_format({'bg_color': 'D2691E'}))  # 11. Chocolate
    colors.append(wb.add_format({'bg_color': 'FFB6C1'}))  # 12. LightPink
    colors.append(wb.add_format({'bg_color': '6495ED'}))  # 13. CornflowerBlue
    colors.append(wb.add_format({'bg_color': 'FFF8DC'}))  # 14. Cornsilk
    colors.append(wb.add_format({'bg_color': 'FFA07A'}))  # 15. LightSalmon


if __name__ == "__main__":
    workbook = xlsxwriter.Workbook('/tmp/mc/T.xlsx')
    setup_colors(workbook)
    templates = sorted(get_all_templates(), key=lambda template: template.name)
    worksheet = workbook.add_worksheet('Templates')
    worksheet.write_row(0, 0, ['Index', 'Template Name', 'Type', 'Description', 'Transforms Sample', 'Destructive'])

    ws_row = 1
    max_toc_lens = [0, 0, 0]
    fill_color_index = 0
    for index, template_in in enumerate(templates):
        if fill_color_index == len(colors):
            fill_color_index = 0
        toc_lens = write_to_toc_ws(worksheet, ws_row, index, template_in)
        if toc_lens[0] > max_toc_lens[0]:
            max_toc_lens[0] = toc_lens[0]
        if toc_lens[1] > max_toc_lens[1]:
            max_toc_lens[1] = toc_lens[1]
        if toc_lens[2] > max_toc_lens[2]: