Respect affinity when getting cpu count
multiprocessing.cpu_count() counts all cores, while DP3 only uses the available cores when run using core affinity settings.
https://git.astron.nl/RD/DP3/-/jobs/605316 showed that the test_n_threads may fail. This change should fix the test, so it also succeeds when it runs with affinity settings.
Edited by Maik Nijhuis