Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects

Function to export *.comm files

Merged usov_i requested to merge JakHolzer-comm_exprt into det1d

Created by: JakHolzer

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • usov_i
  • usov_i
  • usov_i
  • usov_i
    usov_i @usov_i started a thread on commit a3126f02
  • 4 :arg string - string to fill
    5 :arg total_lenght - length of the final string
    6 :return string of the lenght of total_lenght
    7 """
    8 white_spaces = " " * total_lenght
    9 return_string = white_spaces[: -len(str(string))] + str(string)
    10 return return_string
    11
    12
    13 def export_comm(data, path):
    14 """exports data in the *.comm format
    15 :param path: path to file + name
    16 :arg data - data to export, is dict after peak fitting
    17 """
    18
    19 if data["meta"]["indices"] == "hkl":
    • Author Owner

      Created by: ivan-usov

      This code needs to be deduplicated.

      if data["meta"]["indices"] == "hkl":
          extension = ".comm"
      elif data["meta"]["indices"] == "real":
          extension = ".incomm"
      
      with open(str(path + extension), "w") as out_file:
          for keys in data["Measurements"]:
              if extension == ".comm":
                  meas_number_str = fill_string(keys[1:], 6)
                  ...
              else:
                  meas_number_str = fill_string(keys[1:], 4)
                  ...
      etc.

      Or something like that, probably the final form will be different depending on the approach you choose with the string interpolation.

  • Author Owner

    Created by: ivan-usov

    Review: Approved

  • Author Owner

    Merged by: ivan-usov at 2020-09-15 12:24:34 UTC

  • Please register or sign in to reply
    Loading