|  | 
| 12 | 12 | 
 | 
| 13 | 13 | logger = logging.getLogger(__name__) | 
| 14 | 14 | 
 | 
|  | 15 | +FORMAT_ID_T = "id_t" | 
|  | 16 | +FORMAT_ID_TIME_NEST_DAT = "id_t_nest_dat" | 
|  | 17 | +FORMAT_T_ID = "t_id" | 
|  | 18 | + | 
| 15 | 19 | 
 | 
| 16 | 20 | DEFAULTS = { | 
| 17 |  | -    "format": "id_t", | 
|  | 21 | +    "format": FORMAT_ID_T, | 
| 18 | 22 |     "rates": False, | 
| 19 | 23 |     "save_spike_plot_to": None, | 
| 20 | 24 |     "rate_window": 50, | 
| @@ -74,8 +78,9 @@ def process_args(): | 
| 74 | 78 |         metavar="<format>", | 
| 75 | 79 |         default=DEFAULTS["format"], | 
| 76 | 80 |         help="How the spiketimes are represented on each line of file: \n" | 
| 77 |  | -        + "id_t: id of cell, space(s) / tab(s), time of spike (default);\n" | 
| 78 |  | -        + "t_id: time of spike, space(s) / tab(s), id of cell;\n" | 
|  | 81 | +        + "%s: id of cell, space(s) / tab(s), time of spike (default);\n"%FORMAT_ID_T | 
|  | 82 | +        + "%s: id of cell, space(s) / tab(s), time of spike, allowing NEST dat file comments/metadata;\n"%FORMAT_ID_TIME_NEST_DAT | 
|  | 83 | +        + "%s: time of spike, space(s) / tab(s), id of cell;\n"%FORMAT_T_ID | 
| 79 | 84 |         + "sonata: SONATA format HDF5 file containing spike times", | 
| 80 | 85 |     ) | 
| 81 | 86 | 
 | 
| @@ -288,10 +293,10 @@ def run(a=None, **kwargs): | 
| 288 | 293 |             ids_in_file[name] = [] | 
| 289 | 294 | 
 | 
| 290 | 295 |             for line in spikes_file: | 
| 291 |  | -                if not line.startswith("#"): | 
| 292 |  | -                    if a.format == "id_t": | 
|  | 296 | +                if not line.startswith("#") and not (line.startswith("sender") and a.format == FORMAT_ID_TIME_NEST_DAT): | 
|  | 297 | +                    if a.format == FORMAT_ID_T or a.format == FORMAT_ID_TIME_NEST_DAT: | 
| 293 | 298 |                         [id, t] = line.split() | 
| 294 |  | -                    elif a.format == "t_id": | 
|  | 299 | +                    elif a.format == FORMAT_T_ID: | 
| 295 | 300 |                         [t, id] = line.split() | 
| 296 | 301 |                     id_shifted = offset_id + int(float(id)) | 
| 297 | 302 |                     max_id = max(max_id, id_shifted) | 
|  | 
0 commit comments