TIPPGen

TIPPGen stands for TIPP Generic and is the file that contains some generic functions that most people will need!

TIPPGen.CreateLogEntry(CurrentProjectPath, Action, InputFiles, OutputFile)
Parameters:
  • CurrentProjectPath (String) – The path of the currently opened project. (fed into plugins by the program)
  • Action (String) – An action describing what has been done. (Something like “Normalized ”)
  • InputFiles (List with String) – List of the filenames of the files that were used to create the output file.
  • OutputFile (String) – The name of the file that it was saved as.
Returns:

Nothing

Return type:

None

TIPPGen.LoadArray(FilePath)

Opens up the HDF5 type file located in the filepath provided. It loads the “Array” index of the hdf5 file, since it was decided to standardize this. If you want to use multiple indices in a single file in your method do not use this function to load arrays, do it manually. Please take care while using this function. Depending on whether loading was succesfull it will return different things:

If loading was succesful it will return: dask.array,True,h5py.File If loading was unsuccesful it will return: dask.array,False,False

Make sure to check wether loading was succesfull in your code. The reason the h5py.File instance is fed along with the array is because when calculations on the dask.array object are done (at the end of the plugin) these objects needs to be closed! (by simply calling “f.close()” on them. So make sure to do this, otherwise “unknown” behaviour will occur.

Parameters:FilePath (String) – The path to the file in which the array is located.
Returns:The Array to be opened, A boolean which indicates whether opening was succesful,the h5py.File instance associated with the array.
Return type:dask.array,bool,h5py.File
TIPPGen.LoadMetadata(FilePath)

Loads the metadata associated with the file of which the filepath is provided.

Parameters:FilePath (String) – The path to the file of which the metadata needs to be opened.
Returns:the metadata dictionary that was requested and a variable to indicate wether loading was correct. (True/False)
Return type:dictionary,boolean
TIPPGen.LoadProjectMetadataDict(CurrentProject, DictionaryName)
Parameters:
  • CurrentProjectPath (String) – The path of the currently opened project. (fed into plugins by the program)
  • DictionaryName (string) – The dictionary naam
Returns:

Boolean to see if saving was succesful or the asked python object.

Return type:

Bool or a python object

TIPPGen.SaveArray(Array, CurrentProject, FileName)

This function can save arrays and can check whether files already exist. It will suggest options like “filename (1)” if it is already taken.

Parameters:
  • Array (Dask.Array) – The array to save.
  • CurrentProject (String) – The current opened project
  • FileName (String) – The name of the file + extentie. The ext. is needed, because the code searches in the right map depending on the extension.
Returns:

Boolean to indicate whether saving was succesful and the filepath the file was saved to. Please take care that this might not be what was initially fed in due to the user renaming it!

Return type:

bool,string

TIPPGen.SaveArrayAndMetadata(Array, Metadatadict, CurrentProject, FileName)
Parameters:
  • Array (dask.array) – The array to be saved
  • Metadatadict (Dictionary) – The dictionary with the array’s metadata
  • CurrentProject (String) – The current opened project
  • FileName (String) – The name of the file + extentie. The ext. is needed, because the code searches in the right map depending on the extension.
Returns:

Boolean to see if saving was succesful.

Return type:

Bool

TIPPGen.SaveMetaData(Metadatadict, CurrentProject, FileName)

Saves the metadata for the file of which the filepath is provided.

Parameters:
  • Metadatadict (Dictionary) – Dictionary containing the metadata
  • CurrentProject (String) – The current opened project
  • FileName (String) – The name of the file + extentie. The ext. is needed, because the code searches in the right map depending on the extension.
Returns:

Boolean to indicate whether saving was succesful.

Return type:

Bool

TIPPGen.SaveProjectMetadataDict(CurrentProject, DictionaryName, Dictionary)
Parameters:
  • CurrentProjectPath (String) – The path of the currently opened project. (fed into plugins by the program)
  • DictionaryName (string) – The dictionary naam
  • Dictionary (Python Object) – The dictionary or an other python object that works with eval (boolean not allowed)