PIGOR

What PIGOR does

PIGOR (‘Python IGOR’ = PIGOR) aims to help physicists on the NEPTUN beamline to quickly extract the needed information when measuring and configuring or preparing an experiment. It will go through all files in its root folder and will continue to look for files in all subdirectories recursively as well. It will then auto detect [1] the type of measurement and guess what the user wants to know. After analysis of all files, additional files will show up alongside the original measurement files:

  • .png file: plot of the data
  • .md file: usefull information gathered about the measurement in plain text as markdown
  • .html file: same content as the markdown file, but nicely viewable in a modern browser
[1]This will only work if the correct naming convention is used.

PIGORs inner workings

pigor.analyse_files(filepaths='all')

Analyses all given files in list. This function can be used by the command [a].

Parameters:filepaths – list of files to analyse with their relative dir path added

Todo

Change to no override mode. measurement.Measurement.plot(override=False)

Todo

a + today => only analyse files for today

Todo

a + override => override=True

pigor.bool2yn(b)

Converts a boolean to yes or no with the mapping: y = True, n = False.

pigor.create_index()

Creates an index.html listing all directories and subdirectories and their HTML and Markdown files. This function can be used by the command [j].

pigor.find_all_files()

Finds all dat files recursively in all subdirectories ignoring hidden directories and Python specific ones.

Returns a list of filepaths.

pigor.init(create_new_config_file=True)

This function will read the config file and initialize some variables accordingly. This function can be used by the command [i].

Available options:

  • root directory where PIGOR will start to look for measurement files
  • Should PIGOR look for files to analyse recursively?
  • Which file extention do the measurement files posess?
  • What plot output format should PIGOR use?
  • Should PIGOR automatically create an html file?
  • Should PIGOR automatically create a md file?

Note

If no config file can be found, it will create one.

pigor.main()

Main Loop

pigor.print_header(text)

This function prints a beautiful header followed by one empty line.

Parameters:text – text to be displayed as header
pigor.print_help(display='all')

Prints a help menu on the screen for the user. This function can be used by the command [h].

Parameters:display – specify the lenght of the help menu, options are ‘all’ or ‘quick’ (Default value = “all”)
pigor.print_root()

Prints the root for PIGOR, e.g. where it will look for files to analyse. This function can be used by the command [x].

pigor.remove_generated_files(files='all')

Removes the generated png, html and md files. This function can be used by the command [r].

Parameters:files – list of Path objects to files that should be removed; if set to ‘all’ it will delete all generated files (Default value = ‘all’)

Todo

Cover the case when files are not a list of path, e.g. wrong input given.

pigor.show_user(func)

Register a function to be displayed to the user as an option

pigor.yn2bool(s)

Converts yes and no to True and False.