Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 12, 2024
1 parent 3951cb4 commit 027b540
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 31 deletions.
67 changes: 40 additions & 27 deletions scripts/csvMentinkToBin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
print("Starting to read")
# loading the data into a matrix (xyzBdata)
file = r"../data/magneticField/Mentink_20240124.txt"
df = pd.read_csv(file, comment="%", sep='\t',header=None)
print( df.head() )
df = pd.read_csv(file, comment="%", sep="\t", header=None)
print(df.head())

print( "---" )
print("---")
print(df[0:5])
print( "---" )
print("---")

print("Translating to matrix")
xyzBdata = df.values

print( "#####" )
print("#####")
print(xyzBdata[0][0:6])
print(xyzBdata[1][0:6])
print(xyzBdata[2][0:6])
print( "#####" )
print("#####")

print(len(xyzBdata))

Expand All @@ -63,7 +63,20 @@
f = open("output.txt", "wt")

for x in xyzBdata:
f.write( str(x[0]) + "\t" + str(x[1]) + "\t" + str(x[2]) + "\t" + str(x[3]) + "\t" + str(x[4]) + "\t" + str(x[5]) + "\n")
f.write(
str(x[0])
+ "\t"
+ str(x[1])
+ "\t"
+ str(x[2])
+ "\t"
+ str(x[3])
+ "\t"
+ str(x[4])
+ "\t"
+ str(x[5])
+ "\n"
)
if xMax < x[0]:
xMax = x[0]
if yMax < x[1]:
Expand Down Expand Up @@ -117,25 +130,25 @@
# We recenter the volume and redefine axis (x becomes z, y becomes x and z becomes y)
# XLS file distances are expressed in m. We translate to mm.

if( x[2] <= zCutOffHigh and x[2] > zCutOffLow):
y = [
1000 * (x[0] - xCenter),
1000 * (x[1] - yCenter),
1000 * (x[2] - zCenter),
x[3],
x[4],
x[5],
]

# Baby-IAXO is symmetric respect to z (direction along axis) and x (direction parallel to the ground).
# I.e. x and y in the previous axis definition.
# The y-axis symmetry (in the new axis definition) affects the second bore that is not described in this map.
# We apply the corresponding symmetries to define the full map of one magnetic bore in the output binary file.
count = count + 1
fbin.write(struct.pack("<%df" % len(y), *y))
if count < 6:
print(len(y))
print(x[0:6])
print(y[0:6])
if x[2] <= zCutOffHigh and x[2] > zCutOffLow:
y = [
1000 * (x[0] - xCenter),
1000 * (x[1] - yCenter),
1000 * (x[2] - zCenter),
x[3],
x[4],
x[5],
]

# Baby-IAXO is symmetric respect to z (direction along axis) and x (direction parallel to the ground).
# I.e. x and y in the previous axis definition.
# The y-axis symmetry (in the new axis definition) affects the second bore that is not described in this map.
# We apply the corresponding symmetries to define the full map of one magnetic bore in the output binary file.
count = count + 1
fbin.write(struct.pack("<%df" % len(y), *y))
if count < 6:
print(len(y))
print(x[0:6])
print(y[0:6])
fbin.close()
print("Lines writen : " + str(count))
7 changes: 3 additions & 4 deletions src/TRestAxionFieldPropagationProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ void TRestAxionFieldPropagationProcess::InitProcess() {
exit(0);
}

for( size_t n = 0; n < fMagneticField->GetNumberOfVolumes(); n++ )
fMagneticField->ReMap( n, fReMap );

for (size_t n = 0; n < fMagneticField->GetNumberOfVolumes(); n++) fMagneticField->ReMap(n, fReMap);

if (!fAxionField) {
fAxionField = new TRestAxionField();
Expand All @@ -184,7 +182,8 @@ void TRestAxionFieldPropagationProcess::InitProcess() {
fBufferGasAdditionalLength = 0;

fAxionField->AssignMagneticField(fMagneticField);
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Info) fMagneticField->PrintMetadata();
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Info)
fMagneticField->PrintMetadata();
}

RESTDebug << "Axion-field : " << fAxionField << RESTendl;
Expand Down

0 comments on commit 027b540

Please sign in to comment.