get files and keys functions

This file creates the filelist depending on the user input as well as the keywords input

dfitspy.get_files_and_keys.get_files(files, dire=False)

This function extracts the list of files based on the files and dire parameter.

example: get_files([‘fil1.fits,file2.fits’] , ‘/home/Documents’) example: get_files([‘fil1.fits,file2.fits’])

Parameters:
files : list of str

list of files names (without path), it can be:

[‘file1.fits,file2.fits,….’]

[‘file1.fits’]

[‘file1,fits’, ‘file2.fits’]

[‘all’]

dire : str

path of the directory to look in

Returns:
allfiles : list

list of all the files

dfitspy.get_files_and_keys.get_keys(key_string)

This function extracts from a string the list of keys

Parameters:
keystring : string

keys to be requested by user, example:

SEEING

SEEING,AIRMASS

SEEING,ARIMASS,OBID

if a string contains dots, e.g, ESO.SEQ.ARM it will be transform to ESO SEQ ARM (with spaces)

Returns:
keys : list

list of keys (string)

readfits functions

This file organises and reads the FITS files

dfitspy.readfits.dfitsort(listfiles, listkeys, grepping=None)

This function get for all files, the value of all the keywords that are passed

Parameters:
listfiles : lisr

list, with file names (string, path included)

listkeys : list

list, of keywords (strings)

grep : list

list of string, if not false, the grepping valueS will be compared to all the values of the keywords. If all grepping values appear in the header of one file the file will be kept

Returns:
file_dict : dictionary

dictionary, keys=filename & values=dictionnary of keyword-value pairs

Examples

dfitsort([file1, file2], [key1, key2]) <– no grep

dfitsort([file1, file2], [key1, key2], [‘match’, ‘match2’]) <– multi grep

dfitspy.readfits.get_all_keyword(thefile)

This function gets all the keyword in the header of the file

Parameters:
thefile str

path/and/file.txt

Returns:
keywords list

list of keywords (string)

display function

This file organises the terminal display of the output of the code

dfitspy.display.dfitsort_view(values_dict)

This function displays a-la-dfits the requested informations

First we display the number of files that was found and then we display the header with keywords

Parameters:
values_dict : dictionnary

keys=filename & values=dictionnary of keyword-value pair

Returns:
None (prints in terminal)
dfitspy.display.keywords_view(keywords)

This function displays the list of keywords given in parameters. By default it displays it in a 3 columns display.

Parameters:
keywords : list

list of keywords (each keyword is a string)

Returns:
None (display in terminal)

tests module

This file organises the tests of the library

dfitspy.tests.test()

This function calls the test of each module and run them