def check_dict(d, m): for (k, v) in six.iteritems(d): if not isinstance(k, six.string_types): k = six.u(k) if isinstance(v, collections.Mapping): check_dict(v, m.get(k)) else: if isinstance(v, six.string_types): actual = six.u(m.get(box_number(k))) assert_equals(v, actual) elif isinstance(v, int) or isinstance(v, float): actual = m.get(box_number(k)) assert_equals(v, actual) else: actual = m.get(k) assert v.equals(actual)
def import_segment(epoch_group, segment, sources, protocol=None, equipment_setup_root=None): ctx = epoch_group.getDataContext() if protocol is None: protocol = ctx.getProtocol(NEO_PROTOCOL) if protocol is None: protocol = ctx.insertProtocol(NEO_PROTOCOL, NEO_PROTOCOL_TEXT) segment_duration = max(arr.t_stop for arr in segment.analogsignals) segment_duration.units = 'ms' #milliseconds start_time = DateTime(epoch_group.getStart()) inputSources = Maps.newHashMap() outputSources = Maps.newHashMap() for s in sources: if s: s = asclass("Source", s) inputSources.put(s.getLabel(), s) device_parameters = dict(("{}.{}".format(equipment_setup_root, k), v) for (k,v) in segment.annotations.items()) epoch = epoch_group.insertEpoch(inputSources, outputSources, start_time, start_time.plusMillis(int(segment_duration)), protocol, to_map(segment.annotations), to_map(device_parameters) ) if segment.index is not None: epoch.addProperty('index', box_number(segment.index)) if len(segment.analogsignalarrays) > 0: log_warning("Segment contains AnalogSignalArrays. Import of AnalogSignalArrays is currently not supported") for analog_signal in segment.analogsignals: import_analog_signal(epoch, analog_signal, equipment_setup_root) import_timeline_annotations(epoch, segment, start_time) if len(segment.spikes) > 0: logging.warning("Segment contains Spikes. Import of individual Spike data is not yet implemented (but SpikeTrains are).") import_spiketrains(epoch, protocol, segment)
def to_java_set_should_convert_set(): s = set([1, 2, 'abc']) j = to_java_set(s) for item in s: assert_true(j.contains(box_number(item)))
def to_java_set_should_convert_set(): s = set([1, 2, 'abc']) j = to_set(s) for item in s: assert_true(j.contains(box_number(item)))