-
Notifications
You must be signed in to change notification settings - Fork 0
InputType Functions
pyUDLF input class. Responsible for handling the parameters and their values. In this link you can find an example of a configuration file with them. For a UDLF run, it is necessary to change parameters to suit the type of run and this class is responsible for that, to handle the input parameters and their values. For example, at the very least to run the UDLF it is necessary to say which method will be used, as well as the list file and class file, the class inputType does this, as will be demonstrated below. pyUDLF is designed to be used with any version of UDLF, it is self-updating, however, when this document was written we had UDLF version 1.58 available, so the parameter values may be out of date, in this document. If you have new parameters, no problem, even if they are not exemplified, they will work if they are valid in the UDLF. Below the function groups 'set' and 'get' contain the most used parameters, but there are more parameters in UDLF, so there are functions for changing generic parameters that require the parameter name and value.
Input and output file diagram:
- init_parameters
- init_data
- set_method_name
- set_output_file_format
- set_output_matrix_type
- set_output_rk_format
- set_output_file_path
- set_input_matrix_type
- set_matrix_to_rk_sorting
- set_input_images_path
- set_input_rk_format
- set_input_files
- set_ranked_lists_size
- set_dataset_size
- set_lists_file
- set_classes_file
- set_param
- get_param
- get_method_name
- get_classes_file
- get_lists_file
- get_dataset_size
- get_output_file_format
- get_output_matrix_type
- get_output_rk_format
- get_output_file_path
- get_input_matrix_type
- get_input_rk_format
- get_matrix_to_rk_sorting
- get_input_images_path
- get_input_files
- add_new_parameter
- add_input_files
- write_config
- list_parameters_names
- list_param_full
- list_param
- list_param_info
- list_method_info
pyUDLF, through the path provided by the config_path variable ( run_calls ), will read the parameters and values from the configuration file, defaulting to the object created from the inputType class.
INTERNAL USE ONLY
TO DO
Description:
Sets a new value for the "method name" parameter. It can be: "NONE", "CPRR", "RLRECOM", "RLSIM", "CONTEXTRR", "RECKNNGRAPH", "RKGRAPH", "CORGRAPH", "LHRR", "BFSTREE", "RDPAC".
If you have new parameters, no problem, even if they are not exemplified above, they will work if they are valid in the UDLF.
Prototype:
- set_method_name(value: string):
Parameters:
value: new value for the method name. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "output file format" parameter. It can be: "RK", "MATRIX".
Prototype:
- set_output_file_format(value: string):
Parameters:
value: new value for the output file format. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "output matrix type" parameter. It can be: "DIST", "SIM".
Prototype:
- set_output_matrix_type(value: string):
Parameters:
value: new value for the output matrix type. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "output rk format" parameter. It can be: "NUM", "STR", "HTML", "ALL".
Prototype:
- set_output_rk_format(value: string):
Parameters:
value: new value for the PARAMETER. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "output file path" parameter. (do not add the extension -> .txt, .html, and others). Path where the output file will be saved, put the name of the file next to the path. Example: "/home/user/Desktop/UDLF/UDLF/bin/outputName"
Prototype:
- set_output_file_path(value: string):
Parameters:
value: new value for the PARAMETER. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "input matrix type" parameter. It can be: "DIST", "SIM".
Prototype:
- set_input_matrix_type(value: string):
Parameters:
value: new value for the input matrix type. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "matrix to rk sorting" parameter. It can be: "HEAP", "INSERTION".
Prototype:
- set_matrix_to_rk_sorting(value: string):
Parameters:
value: new value for the sorting. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "input images path" parameter. Path of the directory with the dataset images (this string ends with "/"). It is used to build the html ranked lists for output. Example: "images/"
Prototype:
- set_input_images_path(value: string):
Parameters:
value: new value for the PARAMETER. String value only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "input rk format" parameter. It can be:
"NUM", "STR".
Prototype:
- set_rk_format(value: string):
Parameters:
value: new value for the PARAMETER. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
This function can receive two types of parameters:
- String: the task will be set automatically to udl and it is assumed that the string passed is the path to the main file, parameter value "INPUT_FILE".
- List: if it's a list of size 1 containing the string with the path to the main file, it works like the example above. If it is a list with size bigger than 1, it is understood that each index in the list corresponds to a path to the main file, with this, the Task parameter will be set to fusion, and the paths will be the values of the "INPUT_FILES_FUSION_*" parameter, containing from 0 up to the amount of paths passed.
Prototype:
- set_input_files(value: string): or
- set_input_files(value: list):
Parameters:
-
value string: New value for the parameter "INPUT_FILE", this value is the path to the main file (matrix/ranked list) for UDL tasks.
-
value list: if list size is 1, it means that the value is the path to the main file (matrix/ranked list) for UDL tasks, it will be set in the parameter "INPUT_FILE". If the list size is greater than 1, it is a fusion task, and each index in the list corresponds to a value that contains the path to a specific main file, each of them will be set in the parameter "INPUT_FILES_FUSION_*" where * corresponds to each file.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the all ranked lists sizes parameters. All L-parameters of all methods.
Prototype:
- set_ranked_lists_size(value: **integer **):
Parameters:
value: new value for all ranked list sizes.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the "dataset size" parameter, which is number of images in the dataset. It can be TUint.
Prototype:
- set_dataset_size(value: int):
Parameters:
value: new value for the PARAMETER. Int values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the path of the lists file This parameter must contain the path to the list file. Example: "/home/user/Desktop/UDLF/UDLF/Soccer/lists.txt"
Prototype:
- set_lists_file(value: string):
Parameters:
value: new value for the lists file. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the path of the classes file This parameter must contain the path to the classes file. Example: "/home/user/Desktop/UDLF/UDLF/Soccer/classes.txt"
Prototype:
- set_classes_file(value: string):
Parameters:
value: new value for the PARAMETER. String values only.
Return value:
There is no return.
Example:
TO DO
Description:
Sets a new value for the desired parameter. Because UDLF has several parameters, this function sets the value for any parameter, just tell it what the parameter is and its new value.
Prototype:
- set_param(param: string, value: string):
Parameters:
param: Parameter that will receive the new value. String values only.
value: New value for the parameter. Depends on the parameter, can be string or integer.
Return value:
There is no return.
Example:
TO DO
Description:
Since UDLF has several parameters and pyUDLF doesn't have "get" functions for all of them, this function returns the value of some desired parameter.
Prototype:
- get_param(param: string):
Parameters:
param: Parameter that will have its value returned. String values only.
Return value:
The return value can be "int" or "string" depending on the desired parameter.
Example:
TO DO
Description:
Returns a value of type "string" that contains the method that is being used to execute the UDLF. This value can be: "NONE", "CPRR", "RLRECOM", "RLSIM", "CONTEXTRR", "RECKNNGRAPH", "RKGRAPH", "CORGRAPH", "LHRR", "BFSTREE", "RDPAC". If any different method is being used, no problem, pyUDLF understands, the methods exemplified above are the ones available when pyUDLF was developed.
Prototype:
- get_method_name()
Parameters:
This function has no parameter.
Return value:
Value of type "string" with the method used.
Example:
TO DO
Description:
Returns a string value that contains the path to the class file, which would be the value of the "INPUT_FILE_CLASSES" parameter.
Prototype:
- get_classes_file()
Parameters:
This function has no parameter.
Return value:
Value of type "string" with the file class path.
Example:
TO DO
Description:
Returns a string value that contains the path to the list file, which would be the value of the "INPUT_FILE_LIST" parameter.
Prototype:
- get_lists_file()
Parameters:
This function has no parameter.
Return value:
Value of type "string" with the list file path.
Example:
TO DO
Description:
Returns a value of type integer that contains the number of images in the dataset, which would be the value of the "SIZE_DATASET" parameter.
Prototype:
- get_dataset_size()
Parameters:
This function has no parameter.
Return value:
Integer with the number of images in the dataset.
Example:
TO DO
Description:
Returns a string value that contains the type of the output file, which can be "RK" or "MATRIX".
Prototype:
- get_output_file_format()
Parameters:
This function has no parameter.
Return value:
string with the output type, which would be the value of the "OUTPUT_FILE_FORMAT" parameter.
Example:
TO DO
Description:
Returns a string value that contains the type of the output matrix, which can be "DIST" or "SIM".
Prototype:
- get_output_matrix_type()
Parameters:
This function has no parameter.
Return value:
string with the outputmatrix type, which would be the value of the "OUTPUT_MATRIX_TYPE" parameter.
Example:
TO DO
Description:
Returns a string value that contains the format of the output rk, which can be "NUM", "STR", "HTML" or "ALL".
Prototype:
- get_output_rk_format()
Parameters:
This function has no parameter.
Return value:
string with the output rk format , which would be the value of the "OUTPUT_RK_FORMAT" parameter.
Example:
TO DO
Description:
Returns a value of type string that contains the path from where the output file was or will be saved.
Prototype:
- get_output_file_path()
Parameters:
This function has no parameter.
Return value:
string with the path of the output file(s) , which would be the value of the "OUTPUT_FILE_PATH" parameter.
Example:
TO DO
Description:
Returns a string value that contains the type of the input matrix which can be either "DIST" or "SIM".
Prototype:
- get_input_matrix_type()
Parameters:
This function has no parameter.
Return value:
String with the type of input matrix , which would be the value of the "INPUT_MATRIX_TYPE" parameter.
Example:
TO DO
Description:
Returns a string value that contains the format of the input rk which can be either "NUM" or "STR".
Prototype:
- get_input_rk_format()
Parameters:
This function has no parameter.
Return value:
String with the format of input rk, which would be the value of the "INPUT_RK_FORMAT" parameter.
Example:
TO DO
Description:
Returns a string value that contains the Sort Method for the first sort (conversion of the array into sorted lists), which can be "HEAP" or "INSERTION".
Prototype:
- get_matrix_to_rk_sorting()
Parameters:
This function has no parameter.
Return value:
String with the format of sorting method, which would be the value of the "MATRIX_TO_RK_SORTING" parameter.
Example:
TO DO
Description:
Returns a string value that contains Path to the directory containing the images from the dataset. Example: "images/" (this string ends with "/"). It is used to build the html ranked lists for output.
Prototype:
- get_input_images_path()
Parameters:
This function has no parameter.
Return value:
String with the path of the directory, which would be the value of the "INPUT_IMAGES_PATH" parameter.
Example:
TO DO
Description:
This function returns the path to the main file (matrix/ranked list), if the task used was UDL, then it will return a string containing the path, which is the value of the "INPUT_FILE" parameter, if the task used was FUSION, then it will return a list with each element being a path to a different main file, and its size corresponds to the number of files, these values are from the "INPUT_FILES_FUSION_*" parameter.
Prototype:
- get_input_files()
Parameters:
This function has no parameter.
Return value:
- String: Containing the path to the main file (matrix/ranked list) used by UDL tasks.
- List: Each element contains a string containing the path to a different main file, used by FUSION tasks.
Example:
TO DO
Description:
Adds a new parameter to the configuration file. Normally used by pyUDLF itself to add parameters for FUSION execution, and the ranked lists used are in a variable and not saved on the computer. But you can use it if you want to add a new parameter.
Prototype:
- add_new_parameter(param: string, value: string)
Parameters:
param: New parameter name.
value: Nem parameter value.
Return value:
This function has no return.
Example:
TO DO
Description:
Used only when you want to add more parameters for FUSION runs. It does not change from UDL to FUSION, it works only for FUSION tasks. Can take string or a list of strings as parameter, these strings must contain the path to the desired ranked list.
Prototype:
- add_input_files(value: string) or
- add_input_files(value: list)
Parameters:
- value(string): Contains the path to the main file (ranked list) to be added to fusion tasks.
- value(list): It contains a list of strings, each of which contains a path to a different main file (ranked list), to be added to FUSION tasks.
Return value:
It has no return.
Example:
TO DO
Description:
This function writes a new config to the specified path. The path must contain the name of the new config.
Prototype:
- write_config(path= string)
Parameters:
path -> Path of the new config with the name. Ex: "user/desktop/new_config.ini"
Return value:
valor de retorno
Example:
TO DO
Description:
Displays only the names of all the config parameters.
Prototype:
- list_parameters_names()
Parameters:
This function has no parameter.
Return value:
this function has no return
Example:
TO DO
Description:
Displays all parameters with their values and information.
Prototype:
- list_param_full()
Parameters:
This function has no parameter.
Return value:
this function has no return
Example:
TO DO
Description:
Displays all parameters with their values but without the information.
Prototype:
- list_param()
Parameters:
This function has no parameter.
Return value:
this function has no return
Example:
TO DO
Description:
Displays the desired parameter with its value and information
Prototype:
- list_param_info(param: string)
Parameters:
param -> Desired parameter for displaying your data.
Return value:
this function has no return
Example:
TO DO
Description:
In udlf methods are used to recalculate how equal the images are. These methods, e.g. CPRR, RLSIM,..., have unique values for each of them. This function displays all data for a single desired method.
Prototype:
- list_method_info(method: string):
Parameters:
method: Desired method to have your data displayed on the screen. Such as "CPRR", "RLSIM",...
Return value:
this function has no return
Example:
TO DO