Example #1
0
    def __str__(self):
        def fmt(key, val):
            return "{0:10} = {1}".format(key, str(val))

        names = ["id", "modelexpr", "xlo", "xhi", "xmid", "weight", "fluxtype"]
        vals = [getattr(self, n) for n in names]
        return print_fields(names, dict(zip(names, vals)))
Example #2
0
    def __str__(self):
        # Put name first always 
        keylist = self.config.keys()
        keylist = ['name'] + keylist
        full_config = {'name' : self.name}
        full_config.update(self.config)

        return print_fields(keylist, full_config)
Example #3
0
    def __str__(self):
        # Put name first always
        keylist = list(self.config.keys())
        keylist = ['name'] + keylist
        full_config = {'name': self.name}
        full_config.update(self.config)

        return print_fields(keylist, full_config)
Example #4
0
    def __str__(self):
        """
        Return a listing of the attributes listed in self._fields and,
        if present, self._extra_fields.
        """

        fields = self._fields + getattr(self, '_extra_fields', ())
        fdict = dict(izip(fields, [getattr(self, f) for f in fields]))
        return print_fields(fields, fdict)
Example #5
0
    def __str__(self):
        """
        Return a listing of the attributes listed in self._fields and,
        if present, self._extra_fields.
        """

        fields = self._fields + getattr(self, '_extra_fields', ())
        fdict = dict(izip(fields, [getattr(self, f) for f in fields]))
        return print_fields(fields, fdict)
Example #6
0
 def __str__(self):
     names = ['name']
     names.extend(get_keyword_names(self._optfunc))
     #names.remove('full_output')
     # Add the method's name to printed output
     # Don't add to self.config b/c name isn't a
     # fit function config setting
     add_name_config = {}
     add_name_config['name'] = self.name
     add_name_config.update(self.config)
     return print_fields(names, add_name_config)
Example #7
0
 def __str__(self):
     names = ['name']
     names.extend(get_keyword_names(self._optfunc))
     #names.remove('full_output')
     # Add the method's name to printed output
     # Don't add to self.config b/c name isn't a
     # fit function config setting
     add_name_config = {}
     add_name_config['name'] = self.name
     add_name_config.update(self.config)
     return print_fields(names, add_name_config)
Example #8
0
def test_print_fields():
    names = ['a', 'bb', 'ccc']
    vals = {'a': 3, 'bb': 'Ham', 'ccc': numpy.array([1.0, 2.0, 3.0])}

    out = 'a   = 3\nbb  = Ham\nccc = Float64[3]'
    assert utils.print_fields(names, vals) == out
Example #9
0
 def test_print_fields(self):
     names = ['a', 'bb', 'ccc']
     vals = {'a': 3, 'bb': 'Ham', 'ccc': numpy.array([1.0, 2.0, 3.0])}
     self.assertEqual(utils.print_fields(names, vals),
                      'a   = 3\nbb  = Ham\nccc = Float64[3]')
Example #10
0
 def test_print_fields(self):
     names = ['a', 'bb', 'ccc']
     vals = {'a': 3, 'bb': 'Ham', 'ccc': numpy.array([1.0, 2.0, 3.0])}
     self.assertEqual(utils.print_fields(names, vals),
                      'a   = 3\nbb  = Ham\nccc = Float64[3]')
Example #11
0
 def __str__(self):
     return print_fields(self._fields, vars(self))
Example #12
0
    def __str__(self):

        names = ["npts", "min", "max", "total", "mean", "median", "stddev"]
        vals = [getattr(self, n) for n in names]
        return print_fields(names, dict(zip(names, vals)))
Example #13
0
    def __str__(self):

        names = ["xlow", "xhigh", "y"]
        vals = [getattr(self, n) for n in names]
        return print_fields(names, dict(zip(names, vals)))