@@ -42,7 +42,7 @@ def query(self, cat1, cat2, max_distance, *,
42
42
If the table is uploaded or accessed through a URL, it must be
43
43
in VOTable or CSV format with the positions in J2000
44
44
equatorial frame and as decimal degrees numbers.
45
- cat2 : str or file
45
+ cat2 : str, file or `~astropy.table.Table`
46
46
Identifier of the second table. Follows the same rules as *cat1*.
47
47
max_distance : `~astropy.units.Quantity`
48
48
Maximum distance to look for counterparts.
@@ -127,17 +127,22 @@ def _prepare_sending_table(self, cat_index, payload, kwargs, cat, colRA, colDec)
127
127
catstr = 'cat{0}' .format (cat_index )
128
128
if isinstance (cat , str ):
129
129
payload [catstr ] = cat
130
- elif isinstance (cat , Table ):
131
- # write the Table's content into a new, temporary CSV-file
132
- # so that it can be pointed to via the `files` option
133
- # file will be closed when garbage-collected
134
- fp = StringIO ()
135
- cat .write (fp , format = 'ascii.csv' )
136
- fp .seek (0 )
137
- kwargs ['files' ] = {catstr : ('cat1.csv' , fp .read ())}
138
130
else :
139
- # assume it's a file-like object, support duck-typing
140
- kwargs ['files' ] = {catstr : ('cat1.csv' , cat .read ())}
131
+ # create the dictionary of uploaded files
132
+ if "files" not in kwargs :
133
+ kwargs ["files" ] = {}
134
+ if isinstance (cat , Table ):
135
+ # write the Table's content into a new, temporary CSV-file
136
+ # so that it can be pointed to via the `files` option
137
+ # file will be closed when garbage-collected
138
+
139
+ fp = StringIO ()
140
+ cat .write (fp , format = 'ascii.csv' )
141
+ fp .seek (0 )
142
+ kwargs ['files' ].update ({catstr : (f'cat{ cat_index } .csv' , fp .read ())})
143
+ else :
144
+ # assume it's a file-like object, support duck-typing
145
+ kwargs ['files' ].update ({catstr : (f'cat{ cat_index } .csv' , cat .read ())})
141
146
142
147
if not self .is_table_available (cat ):
143
148
if ((colRA is None ) or (colDec is None )):
0 commit comments