madscatt / zazzie

development branch
GNU General Public License v3.0
2 stars 3 forks source link

input filter type_check_and_convert needs to be modified to handle a list of arrays #130

Closed skrueger111 closed 1 year ago

skrueger111 commented 2 years ago

Currently, type_check_and_convert handles a float_array or integer_array, but it doesn't handle a list of float or integer arrays. It needs to be modified, for instance:

def type_check_and_convert_local(self): local_delta_rho = [] for delta_rho in self.delta_rho: svariables={} svariables['temp'] = (delta_rho,'float_array') error, local_variables = input_filter.type_check_and_convert(svariables)

    if len(error) > 0:
        print('error = ', error)
        if not(self.test_flag):
            sys.exit()
        return error

    local_delta_rho.append(local_variables)

self.variables['delta_rho'] = local_delta_rho

where delta_rho = = [[u'-3.2', u'-5.7'], [u'1.6', u'0.26'], [u'0.031', u'-1.74']]

skrueger111 commented 2 years ago

Note that delta_rho needs to be input as a comma-delimited list of strings, rather than a list of lists as noted above. We have decided that it will be input using a semi-colon as a second delimiter, i.e., delta_rho = '-3.2,-5.7; 1.6, 0.26; 0.031, -1.74'. So, we need a nested_float_array option in type_check_and_convert.

skrueger111 commented 1 year ago

I have been importing "input_filter_sasmol.py", which has the nested arrays. If I recall, other changes are needed to convert completely to zazmol in Python 3. But, the nested arrays could be easily added. This is the current workaround so that I could use them in the multi-component analysis module. We may need a new ticket to address the other changes needed for conversion to zazmol, but I think the nested list of arrays is taken care of if we just continue to import input_filter_sasmol.py.

madscatt commented 1 year ago

removed old input_filter, modified input_filter_sasmol (by merging with input_filter_zazmol) so that there is a single input_filter file. Made changes so that they work with zazmol and python 3.