Skip to content

spool.select behaves errors out when fed array/when samples parameter is False #447

@aissah

Description

@aissah

Description

When the samples parameter is set to True, the subspool returned by spool.select contains no patches. This issue seems to behave differently with different formats. In my situation, I have a file format PRODML, and I can get around this with a suggestion from @d-chambers to set the samples parameter to False and modify the query accordingly. However, when I try this with some of the dascore example patches, I get an error as long as the query is an array as opposed to numbers indicating the start and end of the select range.

Example

set-up
import dascore as dc
import numpy as np

mem_spool = dc.examples.random_spool()
dir_spool = dc.examples.spool_to_directory(mem_spool)
spool = dc.spool(dir_spool)

distance_coords = spool[0].coords.get_array('distance')
select_distance = distance_coords[np.arange(0, 298)]

This produces an error:
sub_spool = spool.select(distance=(select_distance))
print(sub_spool[0])

This does not produce an error:
start, end = 0, 100
sub_spool = spool.select(distance=(start, end))
print(sub_spool[0])

In the case of the PRODML files, the above cases work, but this case produces an error:
select_channels = np.arange(0, 298)
sub_spool = spool.select(distance=(select_channels), select=True)
print(sub_spool[0])

Expected behavior

Select data from some channels or distances into a new spool.

Versions

  • OS: Windows 11
  • DasCore Version: 0.1.3
  • Python Version: 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions