fcswrite

raw JSON →
0.6.4 verified Fri May 01 auth: no python maintenance

A lightweight library for writing Flow Cytometry Standard (FCS) files from Python. Current version 0.6.4, requires Python >=3.6. The library is in maintenance mode with infrequent releases.

pip install fcswrite
error AttributeError: module 'fcswrite' has no attribute 'write_fcs'
cause Incorrect import: using 'import fcswrite' instead of 'from fcswrite import fcswrite'
fix
Use: from fcswrite import fcswrite
error TypeError: write_fcs() missing 1 required positional argument: 'data'
cause Calling write_fcs without all required arguments (filename, chnames, data).
fix
Provide all three positional arguments: write_fcs('output.fcs', ['FSC','SSC'], data_matrix)
gotcha The function is named 'write_fcs' but must be accessed via 'fcswrite.write_fcs' after 'from fcswrite import fcswrite'.
fix Use: from fcswrite import fcswrite; fcswrite.write_fcs(...)
gotcha The library does not support writing FCS 3.0 or later versions; it only writes FCS 2.0 files.
fix For FCS 3.0+ support, consider other libraries like 'flowio' or 'fcsy'.

Minimal example to write an FCS file with two channels and three events.

from fcswrite import fcswrite
import numpy as np

# Create some data (events x channels)
data = np.array([[1, 2], [3, 4], [5, 6]], dtype=np.float32)

# Channel names
chnames = ['FSC', 'SSC']

# Write FCS file
fcswrite.write_fcs('test.fcs', chnames, data)
print('FCS file written successfully.')